hotspot/src/cpu/ppc/vm/ppc.ad
author mdoerr
Tue, 04 Jul 2017 15:11:25 +0200
changeset 46615 3fd9b25850f4
parent 46555 5ada291c5063
child 46735 219c4312853e
permissions -rw-r--r--
8181809: PPC64: Leverage mtfprd/mffprd on POWER8 Reviewed-by: mdoerr, simonis Contributed-by: Matthew Brandyberry <mbrandy@linux.vnet.ibm.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
//
46378
4ccca1fdf627 8160748: Inconsistent types for ideal_reg
kbarrett
parents: 42884
diff changeset
     2
// Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
46555
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
     3
// Copyright (c) 2012, 2017 SAP SE. 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,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   450
/*R29,*/             // global TOC
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   451
  R30,
22861
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,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   487
/*R29,*/
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   488
  R30,
22861
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
reg_class rscratch1_bits32_reg(R11);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   493
reg_class rscratch2_bits32_reg(R12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   494
reg_class rarg1_bits32_reg(R3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   495
reg_class rarg2_bits32_reg(R4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   496
reg_class rarg3_bits32_reg(R5);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   497
reg_class rarg4_bits32_reg(R6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   498
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   499
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   500
// 64 Bit Register Classes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   501
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   502
// 64-bit build means 64-bit pointers means hi/lo pairs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   503
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   504
reg_class rscratch1_bits64_reg(R11_H, R11);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   505
reg_class rscratch2_bits64_reg(R12_H, R12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   506
reg_class rarg1_bits64_reg(R3_H, R3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   507
reg_class rarg2_bits64_reg(R4_H, R4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   508
reg_class rarg3_bits64_reg(R5_H, R5);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   509
reg_class rarg4_bits64_reg(R6_H, R6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   510
// Thread register, 'written' by tlsLoadP, see there.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   511
reg_class thread_bits64_reg(R16_H, R16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   512
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   513
reg_class r19_bits64_reg(R19_H, R19);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   514
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   515
// 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
   516
// can be dest (or src) of normal instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   517
reg_class bits64_reg_rw(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   518
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   519
/*R1_H,  R1*/     // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   520
  R2_H,  R2,      // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   521
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   522
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   523
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   524
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   525
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   526
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   527
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   528
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   529
  R11_H, R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   530
  R12_H, R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   531
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   532
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   533
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   534
/*R16_H, R16*/   // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   535
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   536
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   537
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   538
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   539
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   540
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   541
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   542
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   543
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   544
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   545
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   546
  R28_H, R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   547
/*R29_H, R29,*/
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   548
  R30_H, R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   549
  R31_H, R31
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   552
// 64 bit registers used excluding r2, r11 and r12
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   553
// 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
   554
// r2, r11 and r12 internally.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   555
reg_class bits64_reg_leaf_call(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   556
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   557
/*R1_H,  R1*/     // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   558
/*R2_H,  R2*/     // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   559
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   560
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   561
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   562
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   563
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   564
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   565
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   566
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   567
/*R11_H, R11*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   568
/*R12_H, R12*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   569
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   570
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   571
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   572
/*R16_H, R16*/   // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   573
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   574
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   575
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   576
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   577
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   578
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   579
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   580
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   581
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   582
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   583
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   584
  R28_H, R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   585
/*R29_H, R29,*/
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   586
  R30_H, R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   587
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   588
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   589
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   590
// Used to hold the TOC to avoid collisions with expanded DynamicCall
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   591
// which uses r19 as inline cache internally and expanded LeafCall which uses
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   592
// r2, r11 and r12 internally.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   593
reg_class bits64_constant_table_base(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   594
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   595
/*R1_H,  R1*/     // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   596
/*R2_H,  R2*/     // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   597
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   598
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   599
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   600
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   601
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   602
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   603
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   604
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   605
/*R11_H, R11*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   606
/*R12_H, R12*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   607
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   608
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   609
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   610
/*R16_H, R16*/   // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   611
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   612
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   613
/*R19_H, R19*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   614
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   615
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   616
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   617
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   618
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   619
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   620
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   621
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   622
  R28_H, R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   623
/*R29_H, R29,*/
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   624
  R30_H, R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   625
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   626
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   627
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   628
// 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
   629
// only be src of all instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   630
reg_class bits64_reg_ro(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   631
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   632
  R1_H,  R1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   633
  R2_H,  R2,       // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   634
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   635
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   636
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   637
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   638
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   639
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   640
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   641
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   642
  R11_H, R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   643
  R12_H, R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   644
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   645
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   646
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   647
  R16_H, R16,    // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   648
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   649
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   650
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   651
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   652
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   653
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   654
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   655
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   656
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   657
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   658
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   659
  R28_H, R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   660
/*R29_H, R29,*/ // TODO: let allocator handle TOC!!
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   661
  R30_H, R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   662
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   663
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   664
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   665
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   666
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   667
// Special Class for Condition Code Flags Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   668
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   669
reg_class int_flags(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   670
/*CCR0*/             // scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   671
/*CCR1*/             // scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   672
/*CCR2*/             // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   673
/*CCR3*/             // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   674
/*CCR4*/             // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   675
  CCR5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   676
  CCR6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   677
  CCR7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   678
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   679
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   680
reg_class int_flags_ro(
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   681
  CCR0,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   682
  CCR1,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   683
  CCR2,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   684
  CCR3,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   685
  CCR4,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   686
  CCR5,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   687
  CCR6,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   688
  CCR7
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   689
);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   690
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   691
reg_class int_flags_CR0(CCR0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   692
reg_class int_flags_CR1(CCR1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   693
reg_class int_flags_CR6(CCR6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   694
reg_class ctr_reg(SR_CTR);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   695
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   696
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   697
// Float Register Classes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   698
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   699
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   700
reg_class flt_reg(
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
   701
  F0,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   702
  F1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   703
  F2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   704
  F3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   705
  F4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   706
  F5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   707
  F6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   708
  F7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   709
  F8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   710
  F9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   711
  F10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   712
  F11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   713
  F12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   714
  F13,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   715
  F14,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   716
  F15,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   717
  F16,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   718
  F17,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   719
  F18,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   720
  F19,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   721
  F20,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   722
  F21,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   723
  F22,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   724
  F23,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   725
  F24,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   726
  F25,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   727
  F26,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   728
  F27,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   729
  F28,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   730
  F29,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   731
  F30,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   732
  F31               // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   733
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   734
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   735
// Double precision float registers have virtual `high halves' that
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   736
// are needed by the allocator.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   737
reg_class dbl_reg(
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
   738
  F0,  F0_H,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   739
  F1,  F1_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   740
  F2,  F2_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   741
  F3,  F3_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   742
  F4,  F4_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   743
  F5,  F5_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   744
  F6,  F6_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   745
  F7,  F7_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   746
  F8,  F8_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   747
  F9,  F9_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   748
  F10, F10_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   749
  F11, F11_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   750
  F12, F12_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   751
  F13, F13_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   752
  F14, F14_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   753
  F15, F15_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   754
  F16, F16_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   755
  F17, F17_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   756
  F18, F18_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   757
  F19, F19_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   758
  F20, F20_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   759
  F21, F21_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   760
  F22, F22_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   761
  F23, F23_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   762
  F24, F24_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   763
  F25, F25_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   764
  F26, F26_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   765
  F27, F27_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   766
  F28, F28_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   767
  F29, F29_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   768
  F30, F30_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   769
  F31, F31_H     // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   770
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   771
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   772
 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   773
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   774
//----------DEFINITION BLOCK---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   775
// 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
   776
// Current support includes integer values in the range [0, 0x7FFFFFFF]
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   777
// Format:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   778
//        int_def  <name>         ( <int_value>, <expression>);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   779
// Generated Code in ad_<arch>.hpp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   780
//        #define  <name>   (<expression>)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   781
//        // value == <int_value>
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   782
// Generated code in ad_<arch>.cpp adlc_verification()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   783
//        assert( <name> == <int_value>, "Expect (<expression>) to equal <int_value>");
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
definitions %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   786
  // The default cost (of an ALU instruction).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   787
  int_def DEFAULT_COST_LOW        (     30,      30);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   788
  int_def DEFAULT_COST            (    100,     100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   789
  int_def HUGE_COST               (1000000, 1000000);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   790
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   791
  // Memory refs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   792
  int_def MEMORY_REF_COST_LOW     (    200, DEFAULT_COST * 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   793
  int_def MEMORY_REF_COST         (    300, DEFAULT_COST * 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   794
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   795
  // Branches are even more expensive.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   796
  int_def BRANCH_COST             (    900, DEFAULT_COST * 9);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   797
  int_def CALL_COST               (   1300, DEFAULT_COST * 13);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   798
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   799
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   800
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   801
//----------SOURCE BLOCK-------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   802
// This is a block of C++ code which provides values, functions, and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   803
// definitions necessary in the rest of the architecture description.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   804
source_hpp %{
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   805
  // Header information of the source block.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   806
  // Method declarations/definitions which are used outside
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   807
  // the ad-scope can conveniently be defined here.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   808
  //
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   809
  // To keep related declarations/definitions/uses close together,
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   810
  // 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
   811
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   812
  // 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
   813
  // 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
   814
  // operation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   815
  bool followed_by_acquire(const Node *n);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   816
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   817
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   818
source %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   819
38286
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   820
// Should the Matcher clone shifts on addressing modes, expecting them
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   821
// to be subsumed into complex addressing expressions or compute them
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   822
// into registers?
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   823
bool Matcher::clone_address_expressions(AddPNode* m, Matcher::MStack& mstack, VectorSet& address_visited) {
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   824
  return clone_base_plus_offset_address(m, mstack, address_visited);
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   825
}
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   826
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   827
void Compile::reshape_address(AddPNode* addp) {
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   828
}
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   829
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   830
// Optimize load-acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   831
//
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   832
// Check if acquire is unnecessary due to following operation that does
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   833
// acquire anyways.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   834
// Walk the pattern:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   835
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   836
//      n: Load.acq
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   837
//           |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   838
//      MemBarAcquire
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   839
//       |         |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   840
//  Proj(ctrl)  Proj(mem)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   841
//       |         |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   842
//   MemBarRelease/Volatile
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   843
//
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   844
bool followed_by_acquire(const Node *load) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   845
  assert(load->is_Load(), "So far implemented only for loads.");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   846
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   847
  // Find MemBarAcquire.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   848
  const Node *mba = NULL;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   849
  for (DUIterator_Fast imax, i = load->fast_outs(imax); i < imax; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   850
    const Node *out = load->fast_out(i);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   851
    if (out->Opcode() == Op_MemBarAcquire) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   852
      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
   853
      mba = out;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   854
      break;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   855
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   856
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   857
  if (!mba) return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   858
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   859
  // Find following MemBar node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   860
  //
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   861
  // The following node must be reachable by control AND memory
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   862
  // edge to assure no other operations are in between the two nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   863
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   864
  // 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
   865
  Node *mem_proj = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   866
  for (DUIterator_Fast imax, i = mba->fast_outs(imax); i < imax; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   867
    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
   868
    assert(mem_proj->is_Proj(), "only projections here");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   869
    ProjNode *proj = mem_proj->as_Proj();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   870
    if (proj->_con == TypeFunc::Memory &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   871
        !Compile::current()->node_arena()->contains(mem_proj)) // Unmatched old-space only
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   872
      break;
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
  assert(mem_proj->as_Proj()->_con == TypeFunc::Memory, "Graph broken");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   875
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   876
  // Search MemBar behind Proj. If there are other memory operations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   877
  // behind the Proj we lost.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   878
  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
   879
    Node *x = mem_proj->fast_out(j);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   880
    // 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
   881
    if (x->is_Mem()) return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   882
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   883
    // On PPC64 release and volatile are implemented by an instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   884
    // 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
   885
    // acquire before these.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   886
    int xop = x->Opcode();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   887
    if (xop == Op_MemBarRelease || xop == Op_MemBarVolatile) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   888
      // Make sure we're not missing Call/Phi/MergeMem by checking
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   889
      // control edges. The control edge must directly lead back
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   890
      // to the MemBarAcquire
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   891
      Node *ctrl_proj = x->in(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   892
      if (ctrl_proj->is_Proj() && ctrl_proj->in(0) == mba) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   893
        return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   894
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   895
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   896
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   897
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   898
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   899
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   900
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   901
#define __ _masm.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   902
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   903
// Tertiary op of a LoadP or StoreP encoding.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   904
#define REGP_OP true
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   908
// REQUIRED FUNCTIONALITY
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   909
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   910
// !!!!! 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
   911
//       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
   912
//       will point.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   913
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   914
// PPC port: Removed use of lazy constant construct.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   915
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   916
int MachCallStaticJavaNode::ret_addr_offset() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   917
  // It's only a single branch-and-link instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   918
  return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   919
}
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
int MachCallDynamicJavaNode::ret_addr_offset() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   922
  // 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
   923
  // 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
   924
  if (UseInlineCaches)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   925
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   926
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   927
  int vtable_index = this->_vtable_index;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   928
  if (vtable_index < 0) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   929
    // Must be invalid_vtable_index, not nonvirtual_vtable_index.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   930
    assert(vtable_index == Method::invalid_vtable_index, "correct sentinel value");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   931
    return 12;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   932
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   933
    assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   934
    return 24;
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
}
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
int MachCallRuntimeNode::ret_addr_offset() {
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
   939
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
   940
  return 28;
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
   941
#else
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   942
  return 40;
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
   943
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   944
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   945
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   946
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   947
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   948
// condition code conversions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   949
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   950
static int cc_to_boint(int cc) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   951
  return Assembler::bcondCRbiIs0 | (cc & 8);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   954
static int cc_to_inverse_boint(int cc) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   955
  return Assembler::bcondCRbiIs0 | (8-(cc & 8));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   956
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   957
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   958
static int cc_to_biint(int cc, int flags_reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   959
  return (flags_reg << 2) | (cc & 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   960
}
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
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   963
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   964
// Compute padding required for nodes which need alignment. The padding
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   965
// is the number of bytes (not instructions) which will be inserted before
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   966
// the instruction. The padding must match the size of a NOP instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   967
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
   968
// Currently not used on this platform.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   969
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   970
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   971
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   972
// Indicate if the safepoint node needs the polling page as an input.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   973
bool SafePointNode::needs_polling_address_input() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   974
  // The address is loaded from thread by a seperate node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   975
  return true;
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
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
// Emit an interrupt that is caught by the debugger (for debugging compiler).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   981
void emit_break(CodeBuffer &cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   982
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   983
  __ illtrap();
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
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   987
void MachBreakpointNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   988
  st->print("BREAKPOINT");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   989
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   990
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   991
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   992
void MachBreakpointNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   993
  emit_break(cbuf);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   996
uint MachBreakpointNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   997
  return MachNode::size(ra_);
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
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1001
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1002
void emit_nop(CodeBuffer &cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1003
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1004
  __ nop();
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1007
static inline void emit_long(CodeBuffer &cbuf, int value) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1008
  *((int*)(cbuf.insts_end())) = value;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1009
  cbuf.set_insts_end(cbuf.insts_end() + BytesPerInstWord);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1010
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1011
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1012
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1013
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1014
%} // interrupt source
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1015
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1016
source_hpp %{ // Header information of the source block.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1017
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1018
//--------------------------------------------------------------
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1019
//---<  Used for optimization in Compile::Shorten_branches  >---
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1020
//--------------------------------------------------------------
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1021
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1022
class CallStubImpl {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1023
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1024
 public:
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1025
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  1026
  // Emit call stub, compiled java to interpreter.
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1027
  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
  1028
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1029
  // Size of call trampoline stub.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1030
  // 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
  1031
  // 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
  1032
  static uint size_call_trampoline() {
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  1033
    return MacroAssembler::trampoline_stub_size;
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1034
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1035
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1036
  // 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
  1037
  static uint reloc_call_trampoline() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1038
    return 5;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1039
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1040
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1041
};
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1042
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1043
%} // end source_hpp
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1044
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1045
source %{
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1046
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1047
// 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
  1048
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1049
// code sequences:
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
// call-site:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1052
//   branch-and-link to <destination> or <trampoline stub>
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
// Related trampoline stub for this call-site in the stub section:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1055
//   load the call target from the constant pool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1056
//   branch via CTR (LR/link still points to the call-site above)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1057
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1058
void CallStubImpl::emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset) {
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  1059
  address stub = __ emit_trampoline_stub(destination_toc_offset, insts_call_instruction_offset);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1060
  if (stub == NULL) {
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  1061
    ciEnv::current()->record_out_of_memory_failure();
22861
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
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1064
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
// Emit an inline branch-and-link call and a related trampoline stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1068
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1069
// code sequences:
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
// call-site:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1072
//   branch-and-link to <destination> or <trampoline stub>
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1073
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1074
// Related trampoline stub for this call-site in the stub section:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1075
//   load the call target from the constant pool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1076
//   branch via CTR (LR/link still points to the call-site above)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1077
//
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
typedef struct {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1080
  int insts_call_instruction_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1081
  int ret_addr_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1082
} EmitCallOffsets;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1083
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1084
// Emit a branch-and-link instruction that branches to a trampoline.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1085
// - Remember the offset of the branch-and-link instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1086
// - Add a relocation at the branch-and-link instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1087
// - Emit a branch-and-link.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1088
// - Remember the return pc offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1089
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
  1090
  EmitCallOffsets offsets = { -1, -1 };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1091
  const int start_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1092
  offsets.insts_call_instruction_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1093
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1094
  // No entry point given, use the current pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1095
  if (entry_point == NULL) entry_point = __ pc();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1096
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1097
  // Put the entry point as a constant into the constant pool.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1098
  const address entry_point_toc_addr   = __ address_constant(entry_point, RelocationHolder::none);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1099
  if (entry_point_toc_addr == NULL) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1100
    ciEnv::current()->record_out_of_memory_failure();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1101
    return offsets;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1102
  }
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1103
  const int     entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1104
  
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1105
  // Emit the trampoline stub which will be related to the branch-and-link below.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1106
  CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1107
  if (ciEnv::current()->failing()) { return offsets; } // Code cache may be full.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1108
  __ relocate(rtype);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1109
  
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1110
  // 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
  1111
  // 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
  1112
  // serves as dummy and the bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1113
  __ bl((address) __ pc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1114
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1115
  offsets.ret_addr_offset = __ offset() - start_offset;
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
  return offsets;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1118
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1119
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
// Factory for creating loadConL* nodes for large/small constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1123
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1124
static inline jlong replicate_immF(float con) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1125
  // Replicate float con 2 times and pack into vector.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1126
  int val = *((int*)&con);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1127
  jlong lval = val;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1128
  lval = (lval << 32) | (lval & 0xFFFFFFFFl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1129
  return lval;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1130
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1131
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1132
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1133
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1134
const RegMask& MachConstantBaseNode::_out_RegMask = BITS64_CONSTANT_TABLE_BASE_mask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1135
int Compile::ConstantTable::calculate_table_base_offset() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1136
  return 0;  // absolute addressing, no offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1137
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1138
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1139
bool MachConstantBaseNode::requires_postalloc_expand() const { return true; }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1140
void MachConstantBaseNode::postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_) {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  1141
  iRegPdstOper *op_dst = new iRegPdstOper();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  1142
  MachNode *m1 = new loadToc_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  1143
  MachNode *m2 = new loadToc_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1144
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1145
  m1->add_req(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1146
  m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1147
  m1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1148
  m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1149
  m2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1150
  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
  1151
  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
  1152
  nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1153
  nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1154
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1155
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1156
void MachConstantBaseNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1157
  // Is postalloc expanded.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1158
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1159
}
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
uint MachConstantBaseNode::size(PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1162
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1163
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1164
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1165
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1166
void MachConstantBaseNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1167
  st->print("-- \t// MachConstantBaseNode (empty encoding)");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1168
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1169
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1170
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1171
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1172
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1173
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1174
void MachPrologNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1175
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1176
  const long framesize = C->frame_slots() << LogBytesPerInt;
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
  st->print("PROLOG\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1179
  if (C->need_stack_bang(framesize)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1180
    st->print("stack_overflow_check\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1181
  }
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
  if (!false /* TODO: PPC port C->is_frameless_method()*/) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1184
    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
  1185
    st->print("push frame %ld\n\t", -framesize);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1186
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1187
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1188
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1189
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1190
// Macro used instead of the common __ to emulate the pipes of PPC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1191
// 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
  1192
// 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
  1193
// 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
  1194
// 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
  1195
// 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
  1196
// 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
  1197
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1198
#define ___(op) if (UsePower6SchedulerPPC64 && C->hb_scheduling())                    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1199
                  C->hb_scheduling()->_pdScheduling->PdEmulatePipe(ppc64Opcode_##op); \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1200
                _masm.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1201
#define ___stop if (UsePower6SchedulerPPC64 && C->hb_scheduling())                    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1202
                  C->hb_scheduling()->_pdScheduling->PdEmulatePipe(archOpcode_none)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1203
#define ___advance if (UsePower6SchedulerPPC64 && C->hb_scheduling())                 \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1204
                  C->hb_scheduling()->_pdScheduling->advance_offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1205
#else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1206
#define ___(op) if (UsePower6SchedulerPPC64)                                          \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1207
                  Unimplemented();                                                    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1208
                _masm.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1209
#define ___stop if (UsePower6SchedulerPPC64)                                          \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1210
                  Unimplemented()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1211
#define ___advance if (UsePower6SchedulerPPC64)                                       \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1212
                  Unimplemented()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1213
#endif
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
void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1216
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1217
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1218
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1219
  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
  1220
  assert(framesize % (2 * wordSize) == 0, "must preserve 2*wordSize alignment");
22861
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
  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
  1223
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1224
  const Register return_pc            = R20; // Must match return_addr() in frame section.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1225
  const Register callers_sp           = R21;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1226
  const Register push_frame_temp      = R22;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1227
  const Register toc_temp             = R23;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1228
  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
  1229
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1230
  if (method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1231
    // Add nop at beginning of all frameless methods to prevent any
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1232
    // oop instructions from getting overwritten by make_not_entrant
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1233
    // (patching attempt would fail).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1234
    ___(nop) nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1235
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1236
    // Get return pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1237
    ___(mflr) mflr(return_pc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1238
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1239
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1240
  // Calls to C2R adapters often do not accept exceptional returns.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1241
  // We require that their callers must bang for them. But be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1242
  // careful, because some VM calls (such as call site linkage) can
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1243
  // use several kilobytes of stack. But the stack safety zone should
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1244
  // 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
  1245
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1246
  int bangsize = C->bang_size_in_bytes();
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1247
  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
  1248
  if (C->need_stack_bang(bangsize) && UseStackBanging) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1249
    // Unfortunately we cannot use the function provided in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1250
    // 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
  1251
    // insert the code of generate_stack_overflow_check(), see
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1252
    // assembler.cpp for some illuminative comments.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1253
    const int page_size = os::vm_page_size();
35201
996db89f378e 8139864: Improve handling of stack protection zones.
goetz
parents: 34185
diff changeset
  1254
    int bang_end = JavaThread::stack_shadow_zone_size();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1255
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1256
    // This is how far the previous frame's stack banging extended.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1257
    const int bang_end_safe = bang_end;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1258
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1259
    if (bangsize > page_size) {
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1260
      bang_end += bangsize;
22861
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1263
    int bang_offset = bang_end_safe;
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
    while (bang_offset <= bang_end) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1266
      // Need at least one stack bang at end of shadow zone.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1267
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  1268
      // Again I had to copy code, this time from assembler_ppc.cpp,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1269
      // bang_stack_with_offset - see there for comments.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1270
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1271
      // Stack grows down, caller passes positive offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1272
      assert(bang_offset > 0, "must bang with positive offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1273
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1274
      long stdoffset = -bang_offset;
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
      if (Assembler::is_simm(stdoffset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1277
        // Signed 16 bit offset, a simple std is ok.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1278
        if (UseLoadInstructionsForStackBangingPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1279
          ___(ld) ld(R0,  (int)(signed short)stdoffset, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1280
        } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1281
          ___(std) std(R0, (int)(signed short)stdoffset, R1_SP);
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
      } else if (Assembler::is_simm(stdoffset, 31)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1284
        // Use largeoffset calculations for addis & ld/std.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1285
        const int hi = MacroAssembler::largeoffset_si16_si16_hi(stdoffset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1286
        const int lo = MacroAssembler::largeoffset_si16_si16_lo(stdoffset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1287
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1288
        Register tmp = R11;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1289
        ___(addis) addis(tmp, R1_SP, hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1290
        if (UseLoadInstructionsForStackBangingPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1291
          ___(ld) ld(R0, lo, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1292
        } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1293
          ___(std) std(R0, lo, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1294
        }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1295
      } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1296
        ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1297
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1298
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1299
      bang_offset += page_size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1300
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1301
    // R11 trashed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1302
  } // C->need_stack_bang(framesize) && UseStackBanging
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1303
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1304
  unsigned int bytes = (unsigned int)framesize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1305
  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
  1306
  ciMethod *currMethod = C->method();
22861
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
  // Optimized version for most common case.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1309
  if (UsePower6SchedulerPPC64 &&
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1310
      !method_is_frameless && Assembler::is_simm((int)(-offset), 16) &&
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1311
      !(false /* ConstantsALot TODO: PPC port*/)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1312
    ___(or) mr(callers_sp, R1_SP);
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1313
    ___(std) std(return_pc, _abi(lr), R1_SP);
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1314
    ___(stdu) stdu(R1_SP, -offset, R1_SP);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1315
    return;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1316
  }
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
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1319
    // Get callers sp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1320
    ___(or) mr(callers_sp, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1321
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1322
    // Push method's frame, modifies SP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1323
    assert(Assembler::is_uimm(framesize, 32U), "wrong type");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1324
    // The ABI is already accounted for in 'framesize' via the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1325
    // 'out_preserve' area.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1326
    Register tmp = push_frame_temp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1327
    // 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
  1328
    if (Assembler::is_simm(-offset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1329
      ___(stdu) stdu(R1_SP, -offset, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1330
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1331
      long x = -offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1332
      // Had to insert load_const(tmp, -offset).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1333
      ___(addis)  lis( tmp, (int)((signed short)(((x >> 32) & 0xffff0000) >> 16)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1334
      ___(ori)    ori( tmp, tmp, ((x >> 32) & 0x0000ffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1335
      ___(rldicr) sldi(tmp, tmp, 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1336
      ___(oris)   oris(tmp, tmp, (x & 0xffff0000) >> 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1337
      ___(ori)    ori( tmp, tmp, (x & 0x0000ffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1338
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1339
      ___(stdux) stdux(R1_SP, R1_SP, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1340
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1341
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1342
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1343
  // 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
  1344
  // "Randomize" const_size.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1345
  if (ConstantsALot) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1346
    const int num_consts = const_size();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1347
    for (int i = 0; i < num_consts; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1348
      __ long_constant(0xB0B5B00BBABE);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1349
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1350
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1351
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1352
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1353
    // Save return pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1354
    ___(std) std(return_pc, _abi(lr), callers_sp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1355
  }
38228
6dbbdb9ee00e 8155738: C2: fix frame_complete_offset
goetz
parents: 38049
diff changeset
  1356
  
6dbbdb9ee00e 8155738: C2: fix frame_complete_offset
goetz
parents: 38049
diff changeset
  1357
  C->set_frame_complete(cbuf.insts_size());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1358
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1359
#undef ___
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1360
#undef ___stop
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1361
#undef ___advance
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1362
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1363
uint MachPrologNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1364
  // Variable size. determine dynamically.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1365
  return MachNode::size(ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1366
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1367
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1368
int MachPrologNode::reloc() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1369
  // Return number of relocatable values contained in this instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1370
  return 1; // 1 reloc entry for load_const(toc).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1371
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1372
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1373
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1374
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1375
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1376
void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1377
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1378
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1379
  st->print("EPILOG\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1380
  st->print("restore return pc\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1381
  st->print("pop frame\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1382
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1383
  if (do_polling() && C->is_method_compilation()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1384
    st->print("touch polling page\n\t");
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
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1388
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1389
void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1390
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1391
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1392
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1393
  const long framesize = ((long)C->frame_slots()) << LogBytesPerInt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1394
  assert(framesize >= 0, "negative frame-size?");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1395
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1396
  const bool method_needs_polling = do_polling() && C->is_method_compilation();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1397
  const bool method_is_frameless  = false /* TODO: PPC port C->is_frameless_method()*/;
38931
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
  1398
  const Register return_pc        = R31;  // Must survive C-call to enable_stack_reserved_zone().
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1399
  const Register polling_page     = R12;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1400
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1401
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1402
    // Restore return pc relative to callers' sp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1403
    __ ld(return_pc, ((int)framesize) + _abi(lr), R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1404
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1405
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1406
  if (method_needs_polling) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1407
    if (LoadPollAddressFromThread) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1408
      // 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
  1409
      Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1410
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1411
      __ 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
  1412
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1413
  }
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
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1416
    // Move return pc to LR.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1417
    __ mtlr(return_pc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1418
    // Pop frame (fixed frame-size).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1419
    __ addi(R1_SP, R1_SP, (int)framesize);
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
38931
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
  1422
  if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
  1423
    __ reserved_stack_check(return_pc);
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
  1424
  }
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
  1425
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1426
  if (method_needs_polling) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1427
    // 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
  1428
    // polling page was emitted as relocInfo::poll_return_type here.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1429
    __ relocate(relocInfo::poll_return_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1430
    __ load_from_polling_page(polling_page);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1431
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1432
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1433
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1434
uint MachEpilogNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1435
  // Variable size. Determine dynamically.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1436
  return MachNode::size(ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1437
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1438
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1439
int MachEpilogNode::reloc() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1440
  // Return number of relocatable values contained in this instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1441
  return 1; // 1 for load_from_polling_page.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1442
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1443
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1444
const Pipeline * MachEpilogNode::pipeline() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1445
  return MachNode::pipeline_class();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1446
}
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
// This method seems to be obsolete. It is declared in machnode.hpp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1449
// 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
  1450
// get rid of it?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1451
int MachEpilogNode::safepoint_offset() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1452
  assert(do_polling(), "no return for this epilog node");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1453
  return 0;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1456
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1457
void MachLoadPollAddrLateNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1458
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1459
  if (LoadPollAddressFromThread) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1460
    _masm.ld(R11, in_bytes(JavaThread::poll_address_offset()), R16_thread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1461
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1462
    _masm.nop();
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1466
uint MachLoadPollAddrLateNode::size(PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1467
  if (LoadPollAddressFromThread) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1468
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1469
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1470
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1471
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1472
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1473
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1474
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1475
void MachLoadPollAddrLateNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1476
  st->print_cr(" LD R11, PollAddressOffset, R16_thread \t// LoadPollAddressFromThread");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1477
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1478
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1479
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1480
const RegMask &MachLoadPollAddrLateNode::out_RegMask() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1481
  return RSCRATCH1_BITS64_REG_mask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1482
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1483
#endif // PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1484
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1487
// 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
  1488
// rc_stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1489
enum RC { rc_bad, rc_int, rc_float, rc_stack };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1490
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1491
static enum RC rc_class(OptoReg::Name reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1492
  // Return the register class for the given register. The given register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1493
  // 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
  1494
  // enumeration in adGlobals_ppc.hpp.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1495
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1496
  if (reg == OptoReg::Bad) return rc_bad;
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
  // We have 64 integer register halves, starting at index 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1499
  if (reg < 64) return rc_int;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1500
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1501
  // We have 64 floating-point register halves, starting at index 64.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1502
  if (reg < 64+64) return rc_float;
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
  // Between float regs & stack are the flags regs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1505
  assert(OptoReg::is_stack(reg), "blow up if spilling flags");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1506
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1507
  return rc_stack;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1508
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1509
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1510
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
  1511
                        bool do_print, Compile* C, outputStream *st) {
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
  assert(opcode == Assembler::LD_OPCODE   ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1514
         opcode == Assembler::STD_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1515
         opcode == Assembler::LWZ_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1516
         opcode == Assembler::STW_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1517
         opcode == Assembler::LFD_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1518
         opcode == Assembler::STFD_OPCODE ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1519
         opcode == Assembler::LFS_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1520
         opcode == Assembler::STFS_OPCODE,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1521
         "opcode not supported");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1522
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1523
  if (cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1524
    int d =
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1525
      (Assembler::LD_OPCODE == opcode || Assembler::STD_OPCODE == opcode) ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1526
        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
  1527
      : 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
  1528
    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
  1529
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1530
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1531
  else if (do_print) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1532
    st->print("%-7s %s, [R1_SP + #%d+%d] \t// spill copy",
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1533
              op_str,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1534
              Matcher::regName[reg],
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1535
              offset, 0 /* TODO: PPC port C->frame_slots_sp_bias_in_bytes()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1536
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1537
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1538
  return 4; // size
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1539
}
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
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
  1542
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1543
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1544
  // Get registers to move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1545
  OptoReg::Name src_hi = ra_->get_reg_second(in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1546
  OptoReg::Name src_lo = ra_->get_reg_first(in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1547
  OptoReg::Name dst_hi = ra_->get_reg_second(this);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1548
  OptoReg::Name dst_lo = ra_->get_reg_first(this);
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
  enum RC src_hi_rc = rc_class(src_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1551
  enum RC src_lo_rc = rc_class(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1552
  enum RC dst_hi_rc = rc_class(dst_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1553
  enum RC dst_lo_rc = rc_class(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1554
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1555
  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
  1556
  if (src_hi != OptoReg::Bad)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1557
    assert((src_lo&1)==0 && src_lo+1==src_hi &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1558
           (dst_lo&1)==0 && dst_lo+1==dst_hi,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1559
           "expected aligned-adjacent pairs");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1560
  // Generate spill code!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1561
  int size = 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1562
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1563
  if (src_lo == dst_lo && src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1564
    return size;            // Self copy, no move.
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
  // Memory->Memory Spill. Use R0 to hold the value.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1568
  if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1569
    int src_offset = ra_->reg2offset(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1570
    int dst_offset = ra_->reg2offset(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1571
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1572
      assert(src_hi_rc==rc_stack && dst_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1573
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1574
      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
  1575
      if (!cbuf && !do_size) st->print("\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1576
      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
  1577
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1578
      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
  1579
      if (!cbuf && !do_size) st->print("\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1580
      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
  1581
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1582
    return size;
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
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1586
  // Check for float->int copy; requires a trip through memory.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1587
  if (src_lo_rc == rc_float && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1588
    Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1589
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1590
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1591
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1592
  // Check for integer reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1593
  if (src_lo_rc == rc_int && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1594
      Register Rsrc = as_Register(Matcher::_regEncode[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1595
      Register Rdst = as_Register(Matcher::_regEncode[dst_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1596
      size = (Rsrc != Rdst) ? 4 : 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1597
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1598
      if (cbuf) {
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 (size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1601
          __ mr(Rdst, Rsrc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1602
        }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1603
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1604
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1605
      else if (!do_size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1606
        if (size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1607
          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
  1608
        } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1609
          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
  1610
        }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1611
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1612
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1613
      return size;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1616
  // Check for integer store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1617
  if (src_lo_rc == rc_int && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1618
    int dst_offset = ra_->reg2offset(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1619
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1620
      assert(src_hi_rc==rc_int && dst_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1621
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1622
      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
  1623
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1624
      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
  1625
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1626
    return size;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1629
  // Check for integer load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1630
  if (dst_lo_rc == rc_int && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1631
    int src_offset = ra_->reg2offset(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1632
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1633
      assert(dst_hi_rc==rc_int && src_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1634
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1635
      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
  1636
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1637
      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
  1638
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1639
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1640
  }
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
  // Check for float reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1643
  if (src_lo_rc == rc_float && dst_lo_rc == rc_float) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1644
    if (cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1645
      MacroAssembler _masm(cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1646
      FloatRegister Rsrc = as_FloatRegister(Matcher::_regEncode[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1647
      FloatRegister Rdst = as_FloatRegister(Matcher::_regEncode[dst_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1648
      __ fmr(Rdst, Rsrc);
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
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1651
    else if (!do_size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1652
      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
  1653
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1654
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1655
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1656
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1657
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1658
  // Check for float store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1659
  if (src_lo_rc == rc_float && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1660
    int dst_offset = ra_->reg2offset(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1661
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1662
      assert(src_hi_rc==rc_float && dst_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1663
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1664
      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
  1665
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1666
      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
  1667
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1668
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1669
  }
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
  // Check for float load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1672
  if (dst_lo_rc == rc_float && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1673
    int src_offset = ra_->reg2offset(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1674
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1675
      assert(dst_hi_rc==rc_float && src_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1676
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1677
      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
  1678
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1679
      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
  1680
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1681
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1682
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1683
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
  // Check for hi bits still needing moving. Only happens for misaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1686
  // arguments to native calls.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1687
  if (src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1688
    return size;               // Self copy; no move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1689
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1690
  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
  1691
  ShouldNotReachHere(); // Unimplemented
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1692
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1693
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1694
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1695
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1696
void MachSpillCopyNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1697
  if (!ra_)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1698
    st->print("N%d = SpillCopy(N%d)", _idx, in(1)->_idx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1699
  else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1700
    implementation(NULL, ra_, false, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1701
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1702
#endif
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
void MachSpillCopyNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1705
  implementation(&cbuf, ra_, false, NULL);
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
uint MachSpillCopyNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1709
  return implementation(NULL, ra_, true, NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1710
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1711
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1712
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1713
ArchOpcode MachSpillCopyNode_archOpcode(MachSpillCopyNode *n, PhaseRegAlloc *ra_) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1714
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1715
  if (ra_->node_regs_max_index() == 0) return archOpcode_undefined;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1716
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1717
  assert(ra_->node_regs_max_index() != 0, "");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1718
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1719
  // Get registers to move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1720
  OptoReg::Name src_hi = ra_->get_reg_second(n->in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1721
  OptoReg::Name src_lo = ra_->get_reg_first(n->in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1722
  OptoReg::Name dst_hi = ra_->get_reg_second(n);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1723
  OptoReg::Name dst_lo = ra_->get_reg_first(n);
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
  enum RC src_lo_rc = rc_class(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1726
  enum RC dst_lo_rc = rc_class(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1727
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1728
  if (src_lo == dst_lo && src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1729
    return ppc64Opcode_none;            // Self copy, no move.
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
  // Memory->Memory Spill. Use R0 to hold the value.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1733
  if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1734
    return ppc64Opcode_compound;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1735
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1736
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1737
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1738
  // Check for float->int copy; requires a trip through memory.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1739
  if (src_lo_rc == rc_float && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1740
    Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1741
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1742
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
  // Check for integer reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1745
  if (src_lo_rc == rc_int && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1746
    Register Rsrc = as_Register(Matcher::_regEncode[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1747
    Register Rdst = as_Register(Matcher::_regEncode[dst_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1748
    if (Rsrc == Rdst) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1749
      return ppc64Opcode_none;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1750
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1751
      return ppc64Opcode_or;
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
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1754
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1755
  // Check for integer store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1756
  if (src_lo_rc == rc_int && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1757
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1758
      return ppc64Opcode_std;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1759
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1760
      return ppc64Opcode_stw;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1761
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1762
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1763
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1764
  // Check for integer load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1765
  if (dst_lo_rc == rc_int && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1766
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1767
      return ppc64Opcode_ld;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1768
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1769
      return ppc64Opcode_lwz;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1770
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1771
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1772
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1773
  // Check for float reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1774
  if (src_lo_rc == rc_float && dst_lo_rc == rc_float) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1775
    return ppc64Opcode_fmr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1776
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1777
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1778
  // Check for float store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1779
  if (src_lo_rc == rc_float && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1780
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1781
      return ppc64Opcode_stfd;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1782
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1783
      return ppc64Opcode_stfs;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1784
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1785
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1786
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1787
  // Check for float load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1788
  if (dst_lo_rc == rc_float && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1789
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1790
      return ppc64Opcode_lfd;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1791
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1792
      return ppc64Opcode_lfs;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1793
    }
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1796
  // --------------------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1797
  // Check for hi bits still needing moving. Only happens for misaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1798
  // arguments to native calls.
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1799
  if (src_hi == dst_hi) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1800
    return ppc64Opcode_none;               // Self copy; no move.
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1801
  }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1802
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1803
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1804
  return ppc64Opcode_undefined;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1805
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1806
#endif // PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1807
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1808
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1809
void MachNopNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1810
  st->print("NOP \t// %d nops to pad for loops.", _count);
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
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1813
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1814
void MachNopNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1815
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1816
  // _count contains the number of nops needed for padding.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1817
  for (int i = 0; i < _count; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1818
    __ nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1819
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1820
}
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
uint MachNopNode::size(PhaseRegAlloc *ra_) const {
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1823
  return _count * 4;
22861
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
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1827
void BoxLockNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1828
  int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1829
  char reg_str[128];
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1830
  ra_->dump_register(this, reg_str);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1831
  st->print("ADDI    %s, SP, %d \t// box node", reg_str, offset);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1832
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1833
#endif
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
void BoxLockNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1836
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1837
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1838
  int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1839
  int reg    = ra_->get_encode(this);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1840
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1841
  if (Assembler::is_simm(offset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1842
    __ addi(as_Register(reg), R1, offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1843
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1844
    ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1845
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1846
}
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
uint BoxLockNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1849
  // 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
  1850
  return 4;
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
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1854
void MachUEPNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1855
  st->print_cr("---- MachUEPNode ----");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1856
  st->print_cr("...");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1857
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1858
#endif
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
void MachUEPNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1861
  // This is the unverified entry point.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1862
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1863
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1864
  // Inline_cache contains a klass.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1865
  Register ic_klass       = as_Register(Matcher::inline_cache_reg_encode());
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  1866
  Register receiver_klass = R12_scratch2;  // tmp
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1867
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1868
  assert_different_registers(ic_klass, receiver_klass, R11_scratch1, R3_ARG1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1869
  assert(R11_scratch1 == R11, "need prologue scratch register");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1870
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1871
  // Check for NULL argument if we don't have implicit null checks.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1872
  if (!ImplicitNullChecks || !os::zero_page_read_protected()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1873
    if (TrapBasedNullChecks) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1874
      __ trap_null_check(R3_ARG1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1875
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1876
      Label valid;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1877
      __ cmpdi(CCR0, R3_ARG1, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1878
      __ bne_predict_taken(CCR0, valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1879
      // We have a null argument, branch to ic_miss_stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1880
      __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1881
                           relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1882
      __ bind(valid);
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
  // Assume argument is not NULL, load klass from receiver.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1886
  __ load_klass(receiver_klass, R3_ARG1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1887
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1888
  if (TrapBasedICMissChecks) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1889
    __ trap_ic_miss_check(receiver_klass, ic_klass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1890
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1891
    Label valid;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1892
    __ cmpd(CCR0, receiver_klass, ic_klass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1893
    __ beq_predict_taken(CCR0, valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1894
    // We have an unexpected klass, branch to ic_miss_stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1895
    __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1896
                         relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1897
    __ bind(valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1898
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1899
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1900
  // Argument is valid and klass is as expected, continue.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1901
}
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
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1904
// 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
  1905
int MachUEPNode::ep_offset() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1906
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1907
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1908
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1909
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1910
uint MachUEPNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1911
  // Variable size. Determine dynamically.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1912
  return MachNode::size(ra_);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1915
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1916
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1917
%} // interrupt source
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1918
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1919
source_hpp %{ // Header information of the source block.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1920
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1921
class HandlerImpl {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1922
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1923
 public:
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1924
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1925
  static int emit_exception_handler(CodeBuffer &cbuf);
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1926
  static int emit_deopt_handler(CodeBuffer& cbuf);
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1927
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1928
  static uint size_exception_handler() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1929
    // The exception_handler is a b64_patchable.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1930
    return MacroAssembler::b64_patchable_size;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1931
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1932
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1933
  static uint size_deopt_handler() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1934
    // The deopt_handler is a bl64_patchable.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1935
    return MacroAssembler::bl64_patchable_size;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1936
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1937
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1938
};
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1939
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1940
%} // end source_hpp
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1941
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1942
source %{
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1943
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1944
int HandlerImpl::emit_exception_handler(CodeBuffer &cbuf) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1945
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1946
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1947
  address base = __ start_a_stub(size_exception_handler());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1948
  if (base == NULL) return 0; // CodeBuffer::expand failed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1949
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1950
  int offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1951
  __ b64_patchable((address)OptoRuntime::exception_blob()->content_begin(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1952
                       relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1953
  assert(__ offset() - offset == (int)size_exception_handler(), "must be fixed size");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1954
  __ end_a_stub();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1955
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1956
  return offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1957
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1958
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1959
// The deopt_handler is like the exception handler, but it calls to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1960
// 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
  1961
int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1962
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1963
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1964
  address base = __ start_a_stub(size_deopt_handler());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1965
  if (base == NULL) return 0; // CodeBuffer::expand failed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1966
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1967
  int offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1968
  __ bl64_patchable((address)SharedRuntime::deopt_blob()->unpack(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1969
                        relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1970
  assert(__ offset() - offset == (int) size_deopt_handler(), "must be fixed size");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1971
  __ end_a_stub();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1972
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1973
  return offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1974
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1975
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1978
// Use a frame slots bias for frameless methods if accessing the stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1979
static int frame_slots_bias(int reg_enc, PhaseRegAlloc* ra_) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1980
  if (as_Register(reg_enc) == R1_SP) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1981
    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
  1982
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1983
  return 0;
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
const bool Matcher::match_rule_supported(int opcode) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1987
  if (!has_match_rule(opcode))
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1988
    return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1989
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1990
  switch (opcode) {
22879
177361c49b26 8035394: PPC64: Make usage of intrinsic dsqrt depend on processor recognition.
goetz
parents: 22874
diff changeset
  1991
  case Op_SqrtD:
177361c49b26 8035394: PPC64: Make usage of intrinsic dsqrt depend on processor recognition.
goetz
parents: 22874
diff changeset
  1992
    return VM_Version::has_fsqrt();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1993
  case Op_CountLeadingZerosI:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1994
  case Op_CountLeadingZerosL:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1995
  case Op_CountTrailingZerosI:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1996
  case Op_CountTrailingZerosL:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1997
    if (!UseCountLeadingZerosInstructionsPPC64)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1998
      return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1999
    break;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2001
  case Op_PopCountI:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2002
  case Op_PopCountL:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2003
    return (UsePopCountInstruction && VM_Version::has_popcntw());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2004
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2005
  case Op_StrComp:
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
  2006
    return SpecialStringCompareTo;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2007
  case Op_StrEquals:
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
  2008
    return SpecialStringEquals;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2009
  case Op_StrIndexOf:
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
  2010
    return SpecialStringIndexOf;
35581
dd47cf4734f2 8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents: 35232
diff changeset
  2011
  case Op_StrIndexOfChar:
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
  2012
    return SpecialStringIndexOf;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2013
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2014
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2015
  return true;  // Per default match rules are supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2016
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2017
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2018
const bool Matcher::match_rule_supported_vector(int opcode, int vlen) {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2019
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2020
  // TODO
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2021
  // identify extra cases that we might want to provide match rules for
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2022
  // e.g. Op_ vector nodes and other intrinsics while guarding with vlen
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2023
  bool ret_value = match_rule_supported(opcode);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2024
  // Add rules here.
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2025
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2026
  return ret_value;  // Per default match rules are supported.
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2027
}
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2028
38049
e8541793960f 8153998: Masked vector post loops
mcberg
parents: 36554
diff changeset
  2029
const bool Matcher::has_predicated_vectors(void) {
e8541793960f 8153998: Masked vector post loops
mcberg
parents: 36554
diff changeset
  2030
  return false;
e8541793960f 8153998: Masked vector post loops
mcberg
parents: 36554
diff changeset
  2031
}
e8541793960f 8153998: Masked vector post loops
mcberg
parents: 36554
diff changeset
  2032
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 32082
diff changeset
  2033
const int Matcher::float_pressure(int default_pressure_threshold) {
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 32082
diff changeset
  2034
  return default_pressure_threshold;
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 32082
diff changeset
  2035
}
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 32082
diff changeset
  2036
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2037
int Matcher::regnum_to_fpu_offset(int regnum) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2038
  // No user for this method?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2039
  Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2040
  return 999;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2043
const bool Matcher::convL2FSupported(void) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2044
  // fcfids can do the conversion (>= Power7).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2045
  // fcfid + frsp showed rounding problem when result should be 0x3f800001.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2046
  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
  2047
}
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
// Vector width in bytes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2050
const int Matcher::vector_width_in_bytes(BasicType bt) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2051
  assert(MaxVectorSize == 8, "");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2052
  return 8;
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
// Vector ideal reg.
46378
4ccca1fdf627 8160748: Inconsistent types for ideal_reg
kbarrett
parents: 42884
diff changeset
  2056
const uint Matcher::vector_ideal_reg(int size) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2057
  assert(MaxVectorSize == 8 && size == 8, "");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2058
  return Op_RegL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2059
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2060
46378
4ccca1fdf627 8160748: Inconsistent types for ideal_reg
kbarrett
parents: 42884
diff changeset
  2061
const uint Matcher::vector_shift_count_ideal_reg(int size) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2062
  fatal("vector shift is not supported");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2063
  return Node::NotAMachineReg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2064
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2065
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2066
// Limits on vector size (number of elements) loaded into vector.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2067
const int Matcher::max_vector_size(const BasicType bt) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2068
  assert(is_java_primitive(bt), "only primitive type vectors");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2069
  return vector_width_in_bytes(bt)/type2aelembytes(bt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2070
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2071
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2072
const int Matcher::min_vector_size(const BasicType bt) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2073
  return max_vector_size(bt); // Same as max.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2074
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2075
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2076
// PPC doesn't support misaligned vectors store/load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2077
const bool Matcher::misaligned_vectors_ok() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2078
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2079
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2080
22874
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2081
// PPC AES support not yet implemented
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2082
const bool Matcher::pass_original_key_for_aes() {
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2083
  return false;
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2084
}
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2085
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2086
// RETURNS: whether this branch offset is short enough that a short
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2087
// branch can be used.
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
// If the platform does not provide any short branch variants, then
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2090
// this method should return `false' for offset 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2091
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2092
// `Compile::Fill_buffer' will decide on basis of this information
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2093
// whether to do the pass `Compile::Shorten_branches' at all.
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
// And `Compile::Shorten_branches' will decide on basis of this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2096
// information whether to replace particular branch sites by short
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2097
// ones.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2098
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
  2099
  // Is the offset within the range of a ppc64 pc relative branch?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2100
  bool b;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2101
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2102
  const int safety_zone = 3 * BytesPerInstWord;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2103
  b = Assembler::is_simm((offset<0 ? offset-safety_zone : offset+safety_zone),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2104
                         29 - 16 + 1 + 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2105
  return b;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2106
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2107
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2108
const bool Matcher::isSimpleConstant64(jlong value) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2109
  // Probably always true, even if a temp register is required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2110
  return true;
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
/* TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2113
// Make a new machine dependent decode node (with its operands).
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  2114
MachTypeNode *Matcher::make_decode_node() {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2115
  assert(Universe::narrow_oop_base() == NULL && Universe::narrow_oop_shift() == 0,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2116
         "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
  2117
  MachTypeNode *decode = new decodeN_unscaledNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2118
  decode->set_opnd_array(0, new iRegPdstOper());
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2119
  decode->set_opnd_array(1, new iRegNsrcOper());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2120
  return decode;
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
*/
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
// false => size gets scaled to BytesPerLong, ok.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2125
const bool Matcher::init_array_count_is_in_bytes = false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2126
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2127
// Use conditional move (CMOVL) on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2128
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
  2129
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2130
// 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
  2131
// 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
  2132
const int Matcher::float_cmove_cost() { return ConditionalMoveLimit; }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2133
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2134
// Power6 requires postalloc expand (see block.cpp for description of postalloc expand).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2135
const bool Matcher::require_postalloc_expand = true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2136
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2137
// 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
  2138
// the cpu only look at the lower 5/6 bits anyway?
30758
97072ce7c6fe 8080190: PPC64: Fix wrong rotate instructions in the .ad file
simonis
parents: 30303
diff changeset
  2139
// PowerPC requires masked shift counts.
97072ce7c6fe 8080190: PPC64: Fix wrong rotate instructions in the .ad file
simonis
parents: 30303
diff changeset
  2140
const bool Matcher::need_masked_shift_count = true;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2141
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2142
// This affects two different things:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2143
//  - how Decode nodes are matched
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2144
//  - how ImplicitNullCheck opportunities are recognized
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2145
// 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
  2146
// (as operands) into nodes. NullChecks are not prepared to deal with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2147
// Decodes by final_graph_reshaping().
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2148
// If false, final_graph_reshaping() forces the decode behind the Cmp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2149
// for a NullCheck. The matcher matches the Decode node into a register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2150
// Implicit_null_check optimization moves the Decode along with the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2151
// memory operation back up before the NullCheck.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2152
bool Matcher::narrow_oop_use_complex_address() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2153
  // TODO: PPC port if (MatchDecodeNodes) return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2154
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2155
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2156
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2157
bool Matcher::narrow_klass_use_complex_address() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2158
  NOT_LP64(ShouldNotCallThis());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2159
  assert(UseCompressedClassPointers, "only for compressed klass code");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2160
  // TODO: PPC port if (MatchDecodeNodes) return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2161
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2162
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2163
41673
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2164
bool Matcher::const_oop_prefer_decode() {
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2165
  // Prefer ConN+DecodeN over ConP in simple compressed oops mode.
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2166
  return Universe::narrow_oop_base() == NULL;
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2167
}
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2168
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2169
bool Matcher::const_klass_prefer_decode() {
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2170
  // Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2171
  return Universe::narrow_klass_base() == NULL;
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2172
}
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2173
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2174
// 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
  2175
// Intel can load a float constant from a direct address, requiring no
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2176
// extra registers. Most RISCs will have to materialize an address into a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2177
// 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
  2178
const bool Matcher::rematerialize_float_constants = false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2179
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2180
// 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
  2181
// 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
  2182
// 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
  2183
// Java calling convention forces doubles to be aligned.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2184
const bool Matcher::misaligned_doubles_ok = true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2185
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2186
void Matcher::pd_implicit_null_fixup(MachNode *node, uint idx) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2187
 Unimplemented();
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
// Advertise here if the CPU requires explicit rounding operations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2191
// to implement the UseStrictFP mode.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2192
const bool Matcher::strict_fp_requires_explicit_rounding = false;
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
// Do floats take an entire double register or just half?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2195
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2196
// A float occupies a ppc64 double register. For the allocator, a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2197
// ppc64 double register appears as a pair of float registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2198
bool Matcher::float_in_double() { return true; }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2199
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2200
// Do ints take an entire long register or just half?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2201
// The relevant question is how the int is callee-saved:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2202
// 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
  2203
// the relevant 32 bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2204
const bool Matcher::int_in_long = true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2205
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2206
// Constants for c2c and c calling conventions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2207
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2208
const MachRegisterNumbers iarg_reg[8] = {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2209
  R3_num, R4_num, R5_num, R6_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2210
  R7_num, R8_num, R9_num, R10_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2211
};
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
const MachRegisterNumbers farg_reg[13] = {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2214
  F1_num, F2_num, F3_num, F4_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2215
  F5_num, F6_num, F7_num, F8_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2216
  F9_num, F10_num, F11_num, F12_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2217
  F13_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2218
};
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 num_iarg_registers = sizeof(iarg_reg) / sizeof(iarg_reg[0]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2221
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2222
const int num_farg_registers = sizeof(farg_reg) / sizeof(farg_reg[0]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2223
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2224
// 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
  2225
// function is used on startup to build the trampoline stubs in generateOptoStub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2226
// 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
  2227
// arguments in those registers not be available to the callee.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2228
bool Matcher::can_be_java_arg(int reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2229
  // We return true for all registers contained in iarg_reg[] and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2230
  // farg_reg[] and their virtual halves.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2231
  // 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
  2232
  // instead of STWs and LWs in the trampoline stubs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2233
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2234
  if (   reg == R3_num  || reg == R3_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2235
      || reg == R4_num  || reg == R4_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2236
      || reg == R5_num  || reg == R5_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2237
      || reg == R6_num  || reg == R6_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2238
      || reg == R7_num  || reg == R7_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2239
      || reg == R8_num  || reg == R8_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2240
      || reg == R9_num  || reg == R9_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2241
      || reg == R10_num || reg == R10_H_num)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2242
    return true;
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
  if (   reg == F1_num  || reg == F1_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2245
      || reg == F2_num  || reg == F2_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2246
      || reg == F3_num  || reg == F3_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2247
      || reg == F4_num  || reg == F4_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2248
      || reg == F5_num  || reg == F5_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2249
      || reg == F6_num  || reg == F6_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2250
      || reg == F7_num  || reg == F7_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2251
      || reg == F8_num  || reg == F8_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2252
      || reg == F9_num  || reg == F9_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2253
      || reg == F10_num || reg == F10_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2254
      || reg == F11_num || reg == F11_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2255
      || reg == F12_num || reg == F12_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2256
      || reg == F13_num || reg == F13_H_num)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2257
    return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2258
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2259
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2260
}
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
bool Matcher::is_spillable_arg(int reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2263
  return can_be_java_arg(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2264
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2265
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2266
bool Matcher::use_asm_for_ldiv_by_con(jlong divisor) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2267
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2268
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2269
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2270
// Register for DIVI projection of divmodI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2271
RegMask Matcher::divI_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2272
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2273
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2274
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2275
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2276
// Register for MODI projection of divmodI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2277
RegMask Matcher::modI_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2278
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2279
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2280
}
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
// Register for DIVL projection of divmodL.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2283
RegMask Matcher::divL_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2284
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2285
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2286
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2287
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2288
// Register for MODL projection of divmodL.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2289
RegMask Matcher::modL_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2290
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2291
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2292
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2293
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2294
const RegMask Matcher::method_handle_invoke_SP_save_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2295
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2296
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2297
38236
510f77046e00 8154943: AArch64: redundant address computation instructions with vectorization
roland
parents: 38228
diff changeset
  2298
const bool Matcher::convi2l_type_required = true;
510f77046e00 8154943: AArch64: redundant address computation instructions with vectorization
roland
parents: 38228
diff changeset
  2299
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2300
%}
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
//----------ENCODING BLOCK-----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2303
// This block specifies the encoding classes used by the compiler to output
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2304
// byte streams. Encoding classes are parameterized macros used by
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2305
// Machine Instruction Nodes in order to generate the bit encoding of the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2306
// instruction. Operands specify their base encoding interface with the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2307
// interface keyword. There are currently supported four interfaces,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2308
// REG_INTER, CONST_INTER, MEMORY_INTER, & COND_INTER. REG_INTER causes an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2309
// operand to generate a function which returns its register number when
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2310
// queried. CONST_INTER causes an operand to generate a function which
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2311
// returns the value of the constant when queried. MEMORY_INTER causes an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2312
// operand to generate four functions which return the Base Register, the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2313
// 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
  2314
// queried. COND_INTER causes an operand to generate six functions which
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2315
// return the encoding code (ie - encoding bits for the instruction)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2316
// associated with each basic boolean condition for a conditional instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2317
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2318
// Instructions specify two basic values for encoding. Again, a function
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2319
// 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
  2320
// ins_encode keyword to specify their encoding classes (which must be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2321
// a sequence of enc_class names, and their parameters, specified in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2322
// the encoding block), and they use the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2323
// opcode keyword to specify, in order, their primary, secondary, and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2324
// tertiary opcode. Only the opcode sections which a particular instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2325
// needs for encoding need to be specified.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2326
encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2327
  enc_class enc_unimplemented %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2328
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2329
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2330
    __ unimplemented("Unimplemented mach node encoding in AD file.", 13);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2331
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2332
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2333
  enc_class enc_untested %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2334
#ifdef ASSERT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2335
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2336
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2337
    __ untested("Untested mach node encoding in AD file.");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2338
#else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2339
    // TODO: PPC port $archOpcode(ppc64Opcode_none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2340
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2341
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2342
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2343
  enc_class enc_lbz(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2344
    // TODO: PPC port $archOpcode(ppc64Opcode_lbz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2345
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2346
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2347
    __ lbz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2348
  %}
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
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2351
  enc_class enc_lbz_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2352
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2353
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2354
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2355
    __ lbz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2356
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2357
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2358
  %}
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
  enc_class enc_lhz(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2361
    // TODO: PPC port $archOpcode(ppc64Opcode_lhz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2362
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2363
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2364
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2365
    __ lhz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2366
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2367
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2368
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2369
  enc_class enc_lhz_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2370
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2371
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2372
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2373
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2374
    __ lhz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2375
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2376
    __ isync();
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2379
  enc_class enc_lwz(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2380
    // TODO: PPC port $archOpcode(ppc64Opcode_lwz);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2383
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2384
    __ lwz($dst$$Register, Idisp, $mem$$base$$Register);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2387
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2388
  enc_class enc_lwz_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2389
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2392
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2393
    __ lwz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2394
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2395
    __ isync();
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
  enc_class enc_ld(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2399
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2400
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2401
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2402
    // Operand 'ds' requires 4-alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2403
    assert((Idisp & 0x3) == 0, "unaligned offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2404
    __ ld($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2405
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2406
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2407
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2408
  enc_class enc_ld_ac(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2409
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2410
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2411
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2412
    // Operand 'ds' requires 4-alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2413
    assert((Idisp & 0x3) == 0, "unaligned offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2414
    __ ld($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2415
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2416
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2417
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2418
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2419
  enc_class enc_lfd(RegF dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2420
    // TODO: PPC port $archOpcode(ppc64Opcode_lfd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2421
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2422
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2423
    __ lfd($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2424
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2425
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2426
  enc_class enc_load_long_constL(iRegLdst dst, immL src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2427
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2428
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2429
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2430
    int toc_offset = 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2431
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2432
    address const_toc_addr;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2433
    // Create a non-oop constant, no relocation needed.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2434
    // If it is an IC, it has a virtual_call_Relocation.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2435
    const_toc_addr = __ long_constant((jlong)$src$$constant);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2436
    if (const_toc_addr == NULL) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2437
      ciEnv::current()->record_out_of_memory_failure();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2438
      return;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2439
    }
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2440
    
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2441
    // Get the constant's TOC offset.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2442
    toc_offset = __ offset_to_method_toc(const_toc_addr);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2443
    
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2444
    // Keep the current instruction offset in mind.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2445
    ((loadConLNode*)this)->_cbuf_insts_offset = __ offset();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2446
  
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2447
    __ ld($dst$$Register, toc_offset, $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2448
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2449
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2450
  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
  2451
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2452
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2453
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2454
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2455
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2456
      address const_toc_addr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2457
      // Create a non-oop constant, no relocation needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2458
      // If it is an IC, it has a virtual_call_Relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2459
      const_toc_addr = __ long_constant((jlong)$src$$constant);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2460
      if (const_toc_addr == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2461
        ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2462
        return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2463
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2464
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2465
      // Get the constant's TOC offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2466
      const int toc_offset = __ offset_to_method_toc(const_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2467
      // Store the toc offset of the constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2468
      ((loadConL_hiNode*)this)->_const_toc_offset = toc_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2469
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2470
      // Also keep the current instruction offset in mind.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2471
      ((loadConL_hiNode*)this)->_cbuf_insts_offset = __ offset();
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
    __ 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
  2475
  %}
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
%} // encode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2478
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2479
source %{
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
typedef struct {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2482
  loadConL_hiNode *_large_hi;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2483
  loadConL_loNode *_large_lo;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2484
  loadConLNode    *_small;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2485
  MachNode        *_last;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2486
} loadConLNodesTuple;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2487
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  2488
loadConLNodesTuple loadConLNodesTuple_create(PhaseRegAlloc *ra_, Node *toc, immLOper *immSrc,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2489
                                             OptoReg::Name reg_second, OptoReg::Name reg_first) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2490
  loadConLNodesTuple nodes;
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
  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
  2493
  if (large_constant_pool) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2494
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2495
    loadConL_hiNode *m1 = new loadConL_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2496
    loadConL_loNode *m2 = new loadConL_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2497
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2498
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2499
    m1->add_req(NULL, toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2500
    m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2501
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2502
    // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2503
    m1->_opnds[0] = new iRegLdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2504
    m1->_opnds[1] = immSrc;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2505
    m1->_opnds[2] = new iRegPdstOper(); // toc
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2506
    m2->_opnds[0] = new iRegLdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2507
    m2->_opnds[1] = immSrc;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2508
    m2->_opnds[2] = new iRegLdstOper(); // base
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2509
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2510
    // Initialize ins_attrib TOC fields.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2511
    m1->_const_toc_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2512
    m2->_const_toc_offset_hi_node = m1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2513
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2514
    // Initialize ins_attrib instruction offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2515
    m1->_cbuf_insts_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2516
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2517
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2518
    ra_->set_pair(m1->_idx, reg_second, reg_first);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2519
    ra_->set_pair(m2->_idx, reg_second, reg_first);
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
    // Create result.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2522
    nodes._large_hi = m1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2523
    nodes._large_lo = m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2524
    nodes._small = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2525
    nodes._last = nodes._large_lo;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2526
    assert(m2->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2527
  } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2528
    loadConLNode *m2 = new loadConLNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2529
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2530
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2531
    m2->add_req(NULL, toc);
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
    // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2534
    m2->_opnds[0] = new iRegLdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2535
    m2->_opnds[1] = immSrc;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2536
    m2->_opnds[2] = new iRegPdstOper(); // toc
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2537
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2538
    // Initialize ins_attrib instruction offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2539
    m2->_cbuf_insts_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2540
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2541
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2542
    ra_->set_pair(m2->_idx, reg_second, reg_first);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2543
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2544
    // Create result.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2545
    nodes._large_hi = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2546
    nodes._large_lo = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2547
    nodes._small = m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2548
    nodes._last = nodes._small;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2549
    assert(m2->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2550
  }
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
  return nodes;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2553
}
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
%} // source
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2556
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2557
encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2558
  // 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
  2559
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2560
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2561
  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
  2562
    // Create new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2563
    loadConLNodesTuple loadConLNodes =
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  2564
      loadConLNodesTuple_create(ra_, n_toc, op_src,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2565
                                ra_->get_reg_second(this), ra_->get_reg_first(this));
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
    // Push new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2568
    if (loadConLNodes._large_hi) nodes->push(loadConLNodes._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2569
    if (loadConLNodes._last)     nodes->push(loadConLNodes._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2570
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2571
    // some asserts
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2572
    assert(nodes->length() >= 1, "must have created at least 1 node");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2573
    assert(loadConLNodes._last->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2574
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2575
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2576
  enc_class enc_load_long_constP(iRegLdst dst, immP src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2577
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2578
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2579
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2580
    int toc_offset = 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2581
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2582
    intptr_t val = $src$$constant;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2583
    relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2584
    address const_toc_addr;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2585
    if (constant_reloc == relocInfo::oop_type) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2586
      // Create an oop constant and a corresponding relocation.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2587
      AddressLiteral a = __ allocate_oop_address((jobject)val);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2588
      const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2589
      __ relocate(a.rspec());
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2590
    } else if (constant_reloc == relocInfo::metadata_type) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2591
      AddressLiteral a = __ constant_metadata_address((Metadata *)val);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2592
      const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2593
      __ relocate(a.rspec());
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2594
    } else {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2595
      // Create a non-oop constant, no relocation needed.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2596
      const_toc_addr = __ long_constant((jlong)$src$$constant);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2597
    }
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2598
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2599
    if (const_toc_addr == NULL) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2600
      ciEnv::current()->record_out_of_memory_failure();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2601
      return;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2602
    }
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2603
    // Get the constant's TOC offset.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2604
    toc_offset = __ offset_to_method_toc(const_toc_addr);
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
    __ ld($dst$$Register, toc_offset, $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2607
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2608
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2609
  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
  2610
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2611
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2612
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2613
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2614
      intptr_t val = $src$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2615
      relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2616
      address const_toc_addr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2617
      if (constant_reloc == relocInfo::oop_type) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2618
        // Create an oop constant and a corresponding relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2619
        AddressLiteral a = __ allocate_oop_address((jobject)val);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2620
        const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2621
        __ relocate(a.rspec());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2622
      } else if (constant_reloc == relocInfo::metadata_type) {
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  2623
        AddressLiteral a = __ constant_metadata_address((Metadata *)val);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2624
        const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2625
        __ relocate(a.rspec());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2626
      } else {  // non-oop pointers, e.g. card mark base, heap top
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2627
        // Create a non-oop constant, no relocation needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2628
        const_toc_addr = __ long_constant((jlong)$src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2629
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2630
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2631
      if (const_toc_addr == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2632
        ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2633
        return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2634
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2635
      // Get the constant's TOC offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2636
      const int toc_offset = __ offset_to_method_toc(const_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2637
      // Store the toc offset of the constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2638
      ((loadConP_hiNode*)this)->_const_toc_offset = toc_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2639
    }
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
    __ 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
  2642
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2643
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2644
  // 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
  2645
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2646
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2647
  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
  2648
    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
  2649
    if (large_constant_pool) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2650
      // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2651
      loadConP_hiNode *m1 = new loadConP_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2652
      loadConP_loNode *m2 = new loadConP_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2653
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2654
      // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2655
      m1->add_req(NULL, n_toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2656
      m2->add_req(NULL, m1);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2657
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2658
      // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2659
      m1->_opnds[0] = new iRegPdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2660
      m1->_opnds[1] = op_src;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2661
      m1->_opnds[2] = new iRegPdstOper(); // toc
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2662
      m2->_opnds[0] = new iRegPdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2663
      m2->_opnds[1] = op_src;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2664
      m2->_opnds[2] = new iRegLdstOper(); // base
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2665
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2666
      // Initialize ins_attrib TOC fields.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2667
      m1->_const_toc_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2668
      m2->_const_toc_offset_hi_node = m1;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2669
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2670
      // Register allocation for new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2671
      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
  2672
      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
  2673
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2674
      nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2675
      nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2676
      assert(m2->bottom_type()->isa_ptr(), "must be ptr");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2677
    } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2678
      loadConPNode *m2 = new loadConPNode();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2679
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2680
      // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2681
      m2->add_req(NULL, n_toc);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2682
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2683
      // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2684
      m2->_opnds[0] = new iRegPdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2685
      m2->_opnds[1] = op_src;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2686
      m2->_opnds[2] = new iRegPdstOper(); // toc
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2687
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2688
      // Register allocation for new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2689
      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
  2690
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2691
      nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2692
      assert(m2->bottom_type()->isa_ptr(), "must be ptr");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2693
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2694
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2695
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2696
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2697
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2698
  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
  2699
    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
  2700
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2701
    MachNode *m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2702
    if (large_constant_pool) {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2703
      m2 = new loadConFCompNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2704
    } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2705
      m2 = new loadConFNode();
22861
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
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2708
    m2->add_req(NULL, n_toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2709
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2710
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2711
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2712
    m2->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2713
    m2->_opnds[2] = new iRegPdstOper(); // constanttablebase
22861
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
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2716
    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
  2717
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2718
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2719
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2720
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2721
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2722
  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
  2723
    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
  2724
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2725
    MachNode *m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2726
    if (large_constant_pool) {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2727
      m2 = new loadConDCompNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2728
    } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2729
      m2 = new loadConDNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2730
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2731
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2732
    m2->add_req(NULL, n_toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2733
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2734
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2735
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2736
    m2->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2737
    m2->_opnds[2] = new iRegPdstOper(); // constanttablebase
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2738
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2739
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2740
    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
  2741
    nodes->push(m2);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2744
  enc_class enc_stw(iRegIsrc src, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2745
    // TODO: PPC port $archOpcode(ppc64Opcode_stw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2746
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2747
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2748
    __ stw($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2749
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2750
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2751
  enc_class enc_std(iRegIsrc src, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2752
    // TODO: PPC port $archOpcode(ppc64Opcode_std);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2753
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2754
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2755
    // Operand 'ds' requires 4-alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2756
    assert((Idisp & 0x3) == 0, "unaligned offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2757
    __ std($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2758
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2759
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2760
  enc_class enc_stfs(RegF src, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2761
    // TODO: PPC port $archOpcode(ppc64Opcode_stfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2762
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2763
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2764
    __ stfs($src$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2765
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2766
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2767
  enc_class enc_stfd(RegF src, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2768
    // TODO: PPC port $archOpcode(ppc64Opcode_stfd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2769
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2770
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2771
    __ stfd($src$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2772
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2773
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2774
  // Use release_store for card-marking to ensure that previous
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2775
  // oop-stores are visible before the card-mark change.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  2776
  enc_class enc_cms_card_mark(memory mem, iRegLdst releaseFieldAddr, flagsReg crx) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2777
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2778
    // FIXME: Implement this as a cmove and use a fixed condition code
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2779
    // register which is written on every transition to compiled code,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2780
    // e.g. in call-stub and when returning from runtime stubs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2781
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2782
    // Proposed code sequence for the cmove implementation:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2783
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2784
    // Label skip_release;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2785
    // __ beq(CCRfixed, skip_release);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2786
    // __ release();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2787
    // __ bind(skip_release);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2788
    // __ stb(card mark);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2789
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2790
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2791
    Label skip_storestore;
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
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2794
    // Check CMSCollectorCardTableModRefBSExt::_requires_release and do the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2795
    // StoreStore barrier conditionally.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2796
    __ lwz(R0, 0, $releaseFieldAddr$$Register);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  2797
    __ cmpwi($crx$$CondRegister, R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  2798
    __ beq_predict_taken($crx$$CondRegister, skip_storestore);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2799
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2800
    __ li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2801
    __ membar(Assembler::StoreStore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2802
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2803
    __ bind(skip_storestore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2804
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2805
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2806
    // Do the store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2807
    if ($mem$$index == 0) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2808
      __ stb(R0, $mem$$disp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2809
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2810
      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
  2811
      __ stbx(R0, $mem$$base$$Register, $mem$$index$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2812
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2813
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2814
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2815
  enc_class postalloc_expand_encode_oop(iRegNdst dst, iRegPdst src, flagsReg crx) %{
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
    if (VM_Version::has_isel()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2818
      // use isel instruction with Power 7
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2819
      cmpP_reg_imm16Node *n_compare  = new cmpP_reg_imm16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2820
      encodeP_subNode    *n_sub_base = new encodeP_subNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2821
      encodeP_shiftNode  *n_shift    = new encodeP_shiftNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2822
      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
  2823
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2824
      n_compare->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2825
      n_compare->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2826
      n_compare->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2827
      n_compare->_opnds[2] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2828
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2829
      n_sub_base->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2830
      n_sub_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2831
      n_sub_base->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2832
      n_sub_base->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2833
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2834
      n_shift->add_req(n_region, n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2835
      n_shift->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2836
      n_shift->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2837
      n_shift->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2838
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2839
      n_cond_set->add_req(n_region, n_compare, n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2840
      n_cond_set->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2841
      n_cond_set->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2842
      n_cond_set->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2843
      n_cond_set->_bottom_type = _bottom_type;
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
      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
  2846
      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
  2847
      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
  2848
      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
  2849
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2850
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2851
      nodes->push(n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2852
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2853
      nodes->push(n_cond_set);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2854
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2855
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2856
      // before Power 7
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2857
      moveRegNode        *n_move     = new moveRegNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2858
      cmpP_reg_imm16Node *n_compare  = new cmpP_reg_imm16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2859
      encodeP_shiftNode  *n_shift    = new encodeP_shiftNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2860
      cond_sub_baseNode  *n_sub_base = new cond_sub_baseNode();
22861
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
      n_move->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2863
      n_move->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2864
      n_move->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2865
      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
  2866
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2867
      n_compare->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2868
      n_compare->add_prec(n_move);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2869
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2870
      n_compare->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2871
      n_compare->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2872
      n_compare->_opnds[2] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2873
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2874
      n_sub_base->add_req(n_region, n_compare, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2875
      n_sub_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2876
      n_sub_base->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2877
      n_sub_base->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2878
      n_sub_base->_bottom_type = _bottom_type;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2879
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2880
      n_shift->add_req(n_region, n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2881
      n_shift->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2882
      n_shift->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2883
      n_shift->_bottom_type = _bottom_type;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2884
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2885
      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
  2886
      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
  2887
      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
  2888
      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
  2889
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2890
      nodes->push(n_move);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2891
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2892
      nodes->push(n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2893
      nodes->push(n_shift);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2896
    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
  2897
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2898
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2899
  enc_class postalloc_expand_encode_oop_not_null(iRegNdst dst, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2900
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2901
    encodeP_subNode *n1 = new encodeP_subNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2902
    n1->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2903
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2904
    n1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2905
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2906
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2907
    encodeP_shiftNode *n2 = new encodeP_shiftNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2908
    n2->add_req(n_region, n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2909
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2910
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2911
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2912
    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
  2913
    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
  2914
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2915
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2916
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2917
    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
  2918
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2919
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2920
  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
  2921
    decodeN_shiftNode *n_shift    = new decodeN_shiftNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2922
    cmpN_reg_imm0Node *n_compare  = new cmpN_reg_imm0Node();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2923
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2924
    n_compare->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2925
    n_compare->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2926
    n_compare->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2927
    n_compare->_opnds[2] = new immN_0Oper(TypeNarrowOop::NULL_PTR);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2928
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2929
    n_shift->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2930
    n_shift->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2931
    n_shift->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2932
    n_shift->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2933
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2934
    if (VM_Version::has_isel()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2935
      // use isel instruction with Power 7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2936
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2937
      decodeN_addNode *n_add_base = new decodeN_addNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2938
      n_add_base->add_req(n_region, n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2939
      n_add_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2940
      n_add_base->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2941
      n_add_base->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2942
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2943
      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
  2944
      n_cond_set->add_req(n_region, n_compare, n_add_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2945
      n_cond_set->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2946
      n_cond_set->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2947
      n_cond_set->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2948
      n_cond_set->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2949
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2950
      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
  2951
      ra_->set_oop(n_cond_set, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2952
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2953
      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
  2954
      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
  2955
      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
  2956
      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
  2957
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2958
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2959
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2960
      nodes->push(n_add_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2961
      nodes->push(n_cond_set);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2962
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2963
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2964
      // before Power 7
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2965
      cond_add_baseNode *n_add_base = new cond_add_baseNode();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2966
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2967
      n_add_base->add_req(n_region, n_compare, n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2968
      n_add_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2969
      n_add_base->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2970
      n_add_base->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2971
      n_add_base->_bottom_type = _bottom_type;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2972
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2973
      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
  2974
      ra_->set_oop(n_add_base, true);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2975
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2976
      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
  2977
      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
  2978
      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
  2979
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2980
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2981
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2982
      nodes->push(n_add_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2983
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2984
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2985
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2986
  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
  2987
    decodeN_shiftNode *n1 = new decodeN_shiftNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2988
    n1->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2989
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2990
    n1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2991
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2992
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2993
    decodeN_addNode *n2 = new decodeN_addNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2994
    n2->add_req(n_region, n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2995
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2996
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2997
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2998
    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
  2999
    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
  3000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3001
    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
  3002
    ra_->set_oop(n2, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3003
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3004
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3005
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3006
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3007
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3008
  enc_class enc_cmove_reg(iRegIdst dst, flagsRegSrc crx, iRegIsrc src, cmpOp cmp) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3009
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3010
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3011
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3012
    int cc        = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3013
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3014
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3015
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3016
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3017
    __ 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
  3018
    __ mr($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3019
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3020
    __ bind(done);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3023
  enc_class enc_cmove_imm(iRegIdst dst, flagsRegSrc crx, immI16 src, cmpOp cmp) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3024
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3027
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3028
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3029
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3030
    __ 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
  3031
    __ li($dst$$Register, $src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3032
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3033
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3034
  %}
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
  // This enc_class is needed so that scheduler gets proper
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3037
  // input mapping for latency computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3038
  enc_class enc_andc(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3039
    // TODO: PPC port $archOpcode(ppc64Opcode_andc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3040
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3041
    __ andc($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3042
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3043
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3044
  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
  3045
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3046
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3047
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3048
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3049
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3050
    __ cmpwi($crx$$CondRegister, $src$$Register, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3051
    __ li($dst$$Register, $zero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3052
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3053
    __ li($dst$$Register, $notzero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3054
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3055
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3056
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3057
  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
  3058
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3061
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3062
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3063
    __ cmpdi($crx$$CondRegister, $src$$Register, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3064
    __ li($dst$$Register, $zero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3065
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3066
    __ li($dst$$Register, $notzero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3067
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3068
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3069
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3070
  enc_class enc_cmove_bso_stackSlotL(iRegLdst dst, flagsRegSrc crx, stackSlotL mem ) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3071
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3072
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3073
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3074
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3075
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3076
    __ bso($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3077
    __ ld($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3078
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3079
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3080
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3081
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3082
  enc_class enc_cmove_bso_reg(iRegLdst dst, flagsRegSrc crx, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3083
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3084
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3085
    MacroAssembler _masm(&cbuf);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3086
    Label done;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3087
    __ bso($crx$$CondRegister, done);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3088
    __ mffprd($dst$$Register, $src$$FloatRegister);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3089
    // TODO PPC port __ endgroup_if_needed(_size == 12);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3090
    __ bind(done);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3091
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3092
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3093
  enc_class enc_bc(flagsRegSrc crx, cmpOp cmp, Label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3094
    // TODO: PPC port $archOpcode(ppc64Opcode_bc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3095
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3096
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3097
    Label d;   // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3098
    __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3099
    Label* p = ($lbl$$label);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3100
    // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3101
    // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3102
    Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3103
    int cc = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3104
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3105
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3106
    int bhint = Assembler::bhintNoHint;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3107
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3108
    if (UseStaticBranchPredictionForUncommonPathsPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3109
      if (_prob <= PROB_NEVER) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3110
        bhint = Assembler::bhintIsNotTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3111
      } else if (_prob >= PROB_ALWAYS) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3112
        bhint = Assembler::bhintIsTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3113
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3114
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3115
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3116
    __ bc(Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3117
          cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3118
          l);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3119
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3120
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3121
  enc_class enc_bc_far(flagsRegSrc crx, cmpOp cmp, Label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3122
    // 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
  3123
    // to ppc64Opcode_bc in order to hide this detail from the scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3124
    // TODO: PPC port $archOpcode(ppc64Opcode_bc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3125
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3126
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3127
    Label d;    // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3128
    __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3129
    Label* p = ($lbl$$label);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3130
    // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3131
    // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3132
    Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3133
    int cc = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3134
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3135
    int bhint = Assembler::bhintNoHint;
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
    if (UseStaticBranchPredictionForUncommonPathsPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3138
      if (_prob <= PROB_NEVER) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3139
        bhint = Assembler::bhintIsNotTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3140
      } else if (_prob >= PROB_ALWAYS) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3141
        bhint = Assembler::bhintIsTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3142
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3143
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3144
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3145
    // Tell the conditional far branch to optimize itself when being relocated.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3146
    __ bc_far(Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3147
                  cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3148
                  l,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3149
                  MacroAssembler::bc_far_optimize_on_relocate);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3150
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3151
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3152
  // Branch used with Power6 scheduling (can be shortened without changing the node).
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3153
  enc_class enc_bc_short_far(flagsRegSrc crx, cmpOp cmp, Label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3154
    // 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
  3155
    // to ppc64Opcode_bc in order to hide this detail from the scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3156
    // TODO: PPC port $archOpcode(ppc64Opcode_bc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3157
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3158
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3159
    Label d;   // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3160
    __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3161
    Label* p = ($lbl$$label);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3162
    // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3163
    // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3164
    Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3165
    int cc = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3166
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3167
    int bhint = Assembler::bhintNoHint;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3168
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3169
    if (UseStaticBranchPredictionForUncommonPathsPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3170
      if (_prob <= PROB_NEVER) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3171
        bhint = Assembler::bhintIsNotTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3172
      } else if (_prob >= PROB_ALWAYS) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3173
        bhint = Assembler::bhintIsTaken;
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
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3176
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3177
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3178
    if (_size == 8) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3179
      // Tell the conditional far branch to optimize itself when being relocated.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3180
      __ bc_far(Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3181
                    cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3182
                    l,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3183
                    MacroAssembler::bc_far_optimize_on_relocate);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3184
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3185
      __ bc    (Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3186
                    cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3187
                    l);
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
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3190
    Unimplemented();
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3193
  // Postalloc expand emitter for loading a replicatef float constant from
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3194
  // the method's TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3195
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3196
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3197
  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
  3198
    // Create new nodes.
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
    // 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
  3201
    immLOper *op_repl = new immLOper((jlong)replicate_immF(op_src->constantF()));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3202
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3203
    loadConLNodesTuple loadConLNodes =
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3204
      loadConLNodesTuple_create(ra_, n_toc, op_repl,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3205
                                ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3206
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3207
    // Push new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3208
    if (loadConLNodes._large_hi) nodes->push(loadConLNodes._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3209
    if (loadConLNodes._last)     nodes->push(loadConLNodes._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3210
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3211
    assert(nodes->length() >= 1, "must have created at least 1 node");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3212
    assert(loadConLNodes._last->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3213
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3214
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3215
  // This enc_class is needed so that scheduler gets proper
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3216
  // input mapping for latency computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3217
  enc_class enc_poll(immI dst, iRegLdst poll) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3218
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3219
    // Fake operand dst needed for PPC scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3220
    assert($dst$$constant == 0x0, "dst must be 0x0");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3221
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3222
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3223
    // Mark the code position where the load from the safepoint
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3224
    // polling page was emitted as relocInfo::poll_type.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3225
    __ relocate(relocInfo::poll_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3226
    __ load_from_polling_page($poll$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3227
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3228
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3229
  // A Java static call or a runtime call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3230
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3231
  // Branch-and-link relative to a trampoline.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3232
  // 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
  3233
  // In case we call java, the trampoline branches to a interpreter_stub
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3234
  // 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
  3235
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3236
  // This basically looks like this:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3237
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3238
  // >>>> consts      -+  -+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3239
  //                   |   |- offset1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3240
  // [call target1]    | <-+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3241
  // [IC cache]        |- offset2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3242
  // [call target2] <--+
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
  // <<<< consts
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3245
  // >>>> insts
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3246
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3247
  // bl offset16               -+  -+             ??? // How many bits available?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3248
  //                            |   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3249
  // <<<< insts                 |   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3250
  // >>>> stubs                 |   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3251
  //                            |   |- trampoline_stub_Reloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3252
  // trampoline stub:           | <-+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3253
  //   r2 = toc                 |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3254
  //   r2 = [r2 + offset1]      |       // Load call target1 from const section
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3255
  //   mtctr r2                 |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3256
  //   bctr                     |- static_stub_Reloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3257
  // comp_to_interp_stub:   <---+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3258
  //   r1 = toc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3259
  //   ICreg = [r1 + IC_offset]         // Load IC from const section
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3260
  //   r1    = [r1 + offset2]           // Load call target2 from const section
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3261
  //   mtctr r1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3262
  //   bctr
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3263
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3264
  // <<<< stubs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3265
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3266
  // The call instruction in the code either
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3267
  // - 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
  3268
  // - 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
  3269
  // - Branches to the compiled_to_interp stub if the target is interpreted.
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
  // Further there are three relocations from the loads to the constants in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3272
  // the constant section.
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
  // Usage of r1 and r2 in the stubs allows to distinguish them.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3275
  enc_class enc_java_static_call(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3276
    // TODO: PPC port $archOpcode(ppc64Opcode_bl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3277
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3278
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3279
    address entry_point = (address)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3280
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3281
    if (!_method) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3282
      // 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
  3283
      emit_call_with_trampoline_stub(_masm, entry_point, relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3284
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3285
      // Remember the offset not the address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3286
      const int start_offset = __ offset();
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3287
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3288
      // The trampoline stub.
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3289
      // No entry point given, use the current pc.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3290
      // Make sure branch fits into
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3291
      if (entry_point == 0) entry_point = __ pc();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3292
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3293
      // Put the entry point as a constant into the constant pool.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3294
      const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3295
      if (entry_point_toc_addr == NULL) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3296
        ciEnv::current()->record_out_of_memory_failure();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3297
        return;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3298
      }
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3299
      const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3300
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3301
      // Emit the trampoline stub which will be related to the branch-and-link below.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3302
      CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3303
      if (ciEnv::current()->failing()) { return; } // Code cache may be full.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3304
      int method_index = resolved_method_index(cbuf);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3305
      __ relocate(_optimized_virtual ? opt_virtual_call_Relocation::spec(method_index)
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3306
                  : static_call_Relocation::spec(method_index));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3307
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3308
      // The real call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3309
      // 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
  3310
      // 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
  3311
      // serves as dummy and the bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3312
      cbuf.set_insts_mark();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3313
      __ bl(__ pc());  // Emits a relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3314
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3315
      // The stub for call to interpreter.
32082
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 31773
diff changeset
  3316
      address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 31773
diff changeset
  3317
      if (stub == NULL) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3318
        ciEnv::current()->record_failure("CodeCache is full");
32082
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 31773
diff changeset
  3319
        return;
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 31773
diff changeset
  3320
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3321
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3322
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3323
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3324
  // Second node of expanded dynamic call - the call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3325
  enc_class enc_java_dynamic_call_sched(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3326
    // TODO: PPC port $archOpcode(ppc64Opcode_bl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3327
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3328
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3329
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3330
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3331
      // Create a call trampoline stub for the given method.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3332
      const address entry_point = !($meth$$method) ? 0 : (address)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3333
      const address entry_point_const = __ address_constant(entry_point, RelocationHolder::none);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3334
      if (entry_point_const == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3335
        ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3336
        return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3337
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3338
      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
  3339
      CallStubImpl::emit_trampoline_stub(_masm, entry_point_const_toc_offset, __ offset());
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  3340
      if (ra_->C->env()->failing()) { return; } // Code cache may be full.
22861
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
      // Build relocation at call site with ic position as data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3343
      assert((_load_ic_hi_node != NULL && _load_ic_node == NULL) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3344
             (_load_ic_hi_node == NULL && _load_ic_node != NULL),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3345
             "must have one, but can't have both");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3346
      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
  3347
             (_load_ic_node != NULL    && _load_ic_node->_cbuf_insts_offset != -1),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3348
             "must contain instruction offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3349
      const int virtual_call_oop_addr_offset = _load_ic_hi_node != NULL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3350
        ? _load_ic_hi_node->_cbuf_insts_offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3351
        : _load_ic_node->_cbuf_insts_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3352
      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
  3353
      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
  3354
             "should be load from TOC");
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 35085
diff changeset
  3355
      int method_index = resolved_method_index(cbuf);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 35085
diff changeset
  3356
      __ relocate(virtual_call_Relocation::spec(virtual_call_oop_addr, method_index));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3357
    }
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
    // 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
  3360
    // 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
  3361
    // as dummy and bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3362
    __ bl((address) __ pc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3363
  %}
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
  // postalloc expand emitter for virtual calls.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3366
  enc_class postalloc_expand_java_dynamic_call_sched(method meth, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3367
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3368
    // Create the nodes for loading the IC from the TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3369
    loadConLNodesTuple loadConLNodes_IC =
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3370
      loadConLNodesTuple_create(ra_, n_toc, new immLOper((jlong)Universe::non_oop_word()),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3371
                                OptoReg::Name(R19_H_num), OptoReg::Name(R19_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3372
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3373
    // Create the call node.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3374
    CallDynamicJavaDirectSchedNode *call = new CallDynamicJavaDirectSchedNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3375
    call->_method_handle_invoke = _method_handle_invoke;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3376
    call->_vtable_index      = _vtable_index;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3377
    call->_method            = _method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3378
    call->_bci               = _bci;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3379
    call->_optimized_virtual = _optimized_virtual;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3380
    call->_tf                = _tf;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3381
    call->_entry_point       = _entry_point;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3382
    call->_cnt               = _cnt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3383
    call->_argsize           = _argsize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3384
    call->_oop_map           = _oop_map;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3385
    call->_jvms              = _jvms;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3386
    call->_jvmadj            = _jvmadj;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3387
    call->_in_rms            = _in_rms;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3388
    call->_nesting           = _nesting;
35118
b0e320b024c5 8145300: ppc64: fix port of "8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls"
goetz
parents: 35093
diff changeset
  3389
    call->_override_symbolic_info = _override_symbolic_info;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3390
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3391
    // New call needs all inputs of old call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3392
    // Req...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3393
    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
  3394
      // The expanded node does not need toc any more.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3395
      // 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
  3396
      // 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
  3397
      // 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
  3398
      if (i == mach_constant_base_node_input()) {
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3399
        call->add_req(loadConLNodes_IC._last);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3400
      } else {
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3401
        call->add_req(in(i));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3402
      }
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
    // ...as well as prec
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3405
    for (uint i = req(); i < len(); ++i) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3406
      call->add_prec(in(i));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3407
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3408
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3409
    // Remember nodes loading the inline cache into r19.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3410
    call->_load_ic_hi_node = loadConLNodes_IC._large_hi;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3411
    call->_load_ic_node    = loadConLNodes_IC._small;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3412
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3413
    // Operands for new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3414
    call->_opnds[0] = _opnds[0];
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3415
    call->_opnds[1] = _opnds[1];
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3416
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3417
    // Only the inline cache is associated with a register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3418
    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
  3419
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3420
    // Push new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3421
    if (loadConLNodes_IC._large_hi) nodes->push(loadConLNodes_IC._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3422
    if (loadConLNodes_IC._last)     nodes->push(loadConLNodes_IC._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3423
    nodes->push(call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3424
  %}
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
  // Compound version of call dynamic
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3427
  // 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
  3428
  // In the code we have to use $constanttablebase.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3429
  enc_class enc_java_dynamic_call(method meth, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3430
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3431
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3432
    int start_offset = __ offset();
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
    Register Rtoc = (ra_) ? $constanttablebase : R2_TOC;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3435
#if 0
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3436
    int vtable_index = this->_vtable_index;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3437
    if (_vtable_index < 0) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3438
      // Must be invalid_vtable_index, not nonvirtual_vtable_index.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3439
      assert(_vtable_index == Method::invalid_vtable_index, "correct sentinel value");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3440
      Register ic_reg = as_Register(Matcher::inline_cache_reg_encode());
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3441
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3442
      // 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
  3443
      address virtual_call_meta_addr = __ pc();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3444
      // Load a clear inline cache.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3445
      AddressLiteral empty_ic((address) Universe::non_oop_word());
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3446
      bool success = __ load_const_from_method_toc(ic_reg, empty_ic, Rtoc, /*fixed_size*/ true);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3447
      if (!success) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3448
        ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3449
        return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3450
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3451
      // CALL to fixup routine.  Fixup routine uses ScopeDesc info
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3452
      // 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
  3453
      __ relocate(virtual_call_Relocation::spec(virtual_call_meta_addr));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3454
      emit_call_with_trampoline_stub(_masm, (address)$meth$$method, relocInfo::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3455
      assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3456
             "Fix constant in ret_addr_offset()");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3457
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3458
      assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3459
      // Go thru the vtable. Get receiver klass. Receiver already
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3460
      // 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
  3461
      // interpreter expects method in R19_method.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3462
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3463
      __ load_klass(R11_scratch1, R3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3464
35899
0dbc821628fc 8148047: Move the vtable length field to Klass
mgerdin
parents: 35871
diff changeset
  3465
      int entry_offset = in_bytes(Klass::vtable_start_offset()) + _vtable_index * vtableEntry::size_in_bytes();
35871
607bf949dfb3 8147461: Use byte offsets for vtable start and vtable length offsets
mgerdin
parents: 35232
diff changeset
  3466
      int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3467
      __ li(R19_method, v_off);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3468
      __ ldx(R19_method/*method oop*/, R19_method/*method offset*/, R11_scratch1/*class*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3469
      // NOTE: for vtable dispatches, the vtable entry will never be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3470
      // null. However it may very well end up in handle_wrong_method
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3471
      // if the method is abstract for the particular class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3472
      __ ld(R11_scratch1, in_bytes(Method::from_compiled_offset()), R19_method);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3473
      // Call target. Either compiled code or C2I adapter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3474
      __ mtctr(R11_scratch1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3475
      __ bctrl();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3476
      if (((MachCallDynamicJavaNode*)this)->ret_addr_offset() != __ offset() - start_offset) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3477
        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
  3478
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3479
      assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3480
             "Fix constant in ret_addr_offset()");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3481
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3482
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3483
    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
  3484
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3485
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3486
  // a runtime call
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3487
  enc_class enc_java_to_runtime_call (method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3488
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3489
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3490
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3491
    const address start_pc = __ pc();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3492
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3493
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3494
    address entry= !($meth$$method) ? NULL : (address)$meth$$method;
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3495
    __ call_c(entry, relocInfo::runtime_call_type);
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3496
#else
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3497
    // The function we're going to call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3498
    FunctionDescriptor fdtemp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3499
    const FunctionDescriptor* fd = !($meth$$method) ? &fdtemp : (FunctionDescriptor*)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3500
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3501
    Register Rtoc = R12_scratch2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3502
    // Calculate the method's TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3503
    __ calculate_address_from_global_toc(Rtoc, __ method_toc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3504
    // 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
  3505
    // pool entries; call_c_using_toc will optimize the call.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3506
    bool success = __ call_c_using_toc(fd, relocInfo::runtime_call_type, Rtoc);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3507
    if (!success) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3508
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3509
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3510
    }
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3511
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3512
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3513
    // Check the ret_addr_offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3514
    assert(((MachCallRuntimeNode*)this)->ret_addr_offset() ==  __ last_calls_return_pc() - start_pc,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3515
           "Fix constant in ret_addr_offset()");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3516
  %}
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
  // Move to ctr for leaf call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3519
  // This enc_class is needed so that scheduler gets proper
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3520
  // input mapping for latency computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3521
  enc_class enc_leaf_call_mtctr(iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3522
    // TODO: PPC port $archOpcode(ppc64Opcode_mtctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3523
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3524
    __ mtctr($src$$Register);
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
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3527
  // Postalloc expand emitter for runtime leaf calls.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3528
  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
  3529
    loadConLNodesTuple loadConLNodes_Entry;
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3530
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3531
    jlong entry_address = (jlong) this->entry_point();
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3532
    assert(entry_address, "need address here");
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3533
    loadConLNodes_Entry = loadConLNodesTuple_create(ra_, n_toc, new immLOper(entry_address),
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3534
                                                    OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3535
#else
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3536
    // Get the struct that describes the function we are about to call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3537
    FunctionDescriptor* fd = (FunctionDescriptor*) this->entry_point();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3538
    assert(fd, "need fd here");
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3539
    jlong entry_address = (jlong) fd->entry();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3540
    // new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3541
    loadConLNodesTuple loadConLNodes_Env;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3542
    loadConLNodesTuple loadConLNodes_Toc;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3543
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3544
    // Create nodes and operands for loading the entry point.
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3545
    loadConLNodes_Entry = loadConLNodesTuple_create(ra_, n_toc, new immLOper(entry_address),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3546
                                                    OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3547
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3548
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3549
    // Create nodes and operands for loading the env pointer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3550
    if (fd->env() != NULL) {
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3551
      loadConLNodes_Env = loadConLNodesTuple_create(ra_, n_toc, new immLOper((jlong) fd->env()),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3552
                                                    OptoReg::Name(R11_H_num), OptoReg::Name(R11_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3553
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3554
      loadConLNodes_Env._large_hi = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3555
      loadConLNodes_Env._large_lo = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3556
      loadConLNodes_Env._small    = NULL;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3557
      loadConLNodes_Env._last = new loadConL16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3558
      loadConLNodes_Env._last->_opnds[0] = new iRegLdstOper();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3559
      loadConLNodes_Env._last->_opnds[1] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3560
      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
  3561
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3562
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3563
    // Create nodes and operands for loading the Toc point.
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3564
    loadConLNodes_Toc = loadConLNodesTuple_create(ra_, n_toc, new immLOper((jlong) fd->toc()),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3565
                                                  OptoReg::Name(R2_H_num), OptoReg::Name(R2_num));
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3566
#endif // ABI_ELFv2
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3567
    // mtctr node
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3568
    MachNode *mtctr = new CallLeafDirect_mtctrNode();
22861
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
    assert(loadConLNodes_Entry._last != NULL, "entry must exist");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3571
    mtctr->add_req(0, loadConLNodes_Entry._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3572
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3573
    mtctr->_opnds[0] = new iRegLdstOper();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3574
    mtctr->_opnds[1] = new iRegLdstOper();
22861
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
    // call node
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3577
    MachCallLeafNode *call = new CallLeafDirectNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3578
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3579
    call->_opnds[0] = _opnds[0];
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3580
    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
  3581
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3582
    // Make the new call node look like the old one.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3583
    call->_name        = _name;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3584
    call->_tf          = _tf;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3585
    call->_entry_point = _entry_point;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3586
    call->_cnt         = _cnt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3587
    call->_argsize     = _argsize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3588
    call->_oop_map     = _oop_map;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3589
    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
  3590
    call->_jvms        = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3591
    call->_jvmadj      = _jvmadj;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3592
    call->_in_rms      = _in_rms;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3593
    call->_nesting     = _nesting;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3594
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3595
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3596
    // New call needs all inputs of old call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3597
    // Req...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3598
    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
  3599
      if (i != mach_constant_base_node_input()) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3600
        call->add_req(in(i));
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3604
    // These must be reqired edges, as the registers are live up to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3605
    // 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
  3606
    call->add_req(mtctr);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3607
#if !defined(ABI_ELFv2)
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3608
    call->add_req(loadConLNodes_Env._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3609
    call->add_req(loadConLNodes_Toc._last);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3610
#endif
22861
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
    // ...as well as prec
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3613
    for (uint i = req(); i < len(); ++i) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3614
      call->add_prec(in(i));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3615
    }
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
    // registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3618
    ra_->set1(mtctr->_idx, OptoReg::Name(SR_CTR_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3619
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3620
    // Insert the new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3621
    if (loadConLNodes_Entry._large_hi) nodes->push(loadConLNodes_Entry._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3622
    if (loadConLNodes_Entry._last)     nodes->push(loadConLNodes_Entry._last);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3623
#if !defined(ABI_ELFv2)
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3624
    if (loadConLNodes_Env._large_hi)   nodes->push(loadConLNodes_Env._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3625
    if (loadConLNodes_Env._last)       nodes->push(loadConLNodes_Env._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3626
    if (loadConLNodes_Toc._large_hi)   nodes->push(loadConLNodes_Toc._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3627
    if (loadConLNodes_Toc._last)       nodes->push(loadConLNodes_Toc._last);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3628
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3629
    nodes->push(mtctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3630
    nodes->push(call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3631
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3632
%}
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
//----------FRAME--------------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3635
// Definition of frame structure and management information.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3636
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3637
frame %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3638
  // 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
  3639
  stack_direction(TOWARDS_LOW);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3640
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3641
  // These two registers define part of the calling convention between
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3642
  // compiled code and the interpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3643
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3644
  // Inline Cache Register or method for I2C.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3645
  inline_cache_reg(R19); // R19_method
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
  // Method Oop Register when calling interpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3648
  interpreter_method_oop_reg(R19); // R19_method
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3649
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3650
  // Optional: name the operand used by cisc-spilling to access
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3651
  // [stack_pointer + offset].
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3652
  cisc_spilling_operand_name(indOffset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3653
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3654
  // Number of stack slots consumed by a Monitor enter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3655
  sync_stack_slots((frame::jit_monitor_size / VMRegImpl::stack_slot_size));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3656
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3657
  // Compiled code's Frame Pointer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3658
  frame_pointer(R1); // R1_SP
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
  // Interpreter stores its frame pointer in a register which is
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3661
  // stored to the stack by I2CAdaptors. I2CAdaptors convert from
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3662
  // interpreted java to compiled java.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3663
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3664
  // R14_state holds pointer to caller's cInterpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3665
  interpreter_frame_pointer(R14); // R14_state
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3666
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3667
  stack_alignment(frame::alignment_in_bytes);
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
  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
  3670
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3671
  // Number of outgoing stack slots killed above the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3672
  // out_preserve_stack_slots for calls to C. Supports the var-args
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3673
  // backing area for register parms.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3674
  //
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3675
  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
  3676
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3677
  // The after-PROLOG location of the return address. Location of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3678
  // return address specifies a type (REG or STACK) and a number
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3679
  // representing the register number (i.e. - use a register name) or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3680
  // stack slot.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3681
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3682
  // A: Link register is stored in stack slot ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3683
  // 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
  3684
  // 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
  3685
  //    at the end of the prolog.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3686
  // B: We use R20, now.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3687
  //return_addr(REG R20);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3688
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3689
  // G: After reading the comments made by all the luminaries on their
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3690
  //    failure to tell the compiler where the return address really is,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3691
  //    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
  3692
  //    4 what apparently works and saves us some spills.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3693
  return_addr(STACK 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3694
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3695
  // This is the body of the function
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3696
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3697
  // void Matcher::calling_convention(OptoRegPair* sig, // array of ideal regs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3698
  //                                  uint length,      // length of array
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3699
  //                                  bool is_outgoing)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3700
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3701
  // The `sig' array is to be updated. sig[j] represents the location
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3702
  // of the j-th argument, either a register or a stack slot.
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
  // Comment taken from i486.ad:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3705
  // Body of function which returns an integer array locating
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3706
  // arguments either in registers or in stack slots. Passed an array
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3707
  // of ideal registers called "sig" and a "length" count. Stack-slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3708
  // offsets are based on outgoing arguments, i.e. a CALLER setting up
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3709
  // arguments for a CALLEE. Incoming stack arguments are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3710
  // automatically biased by the preserve_stack_slots field above.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3711
  calling_convention %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3712
    // No difference between ingoing/outgoing. Just pass false.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3713
    SharedRuntime::java_calling_convention(sig_bt, regs, length, false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3714
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3715
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3716
  // Comment taken from i486.ad:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3717
  // Body of function which returns an integer array locating
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3718
  // arguments either in registers or in stack slots. Passed an array
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3719
  // of ideal registers called "sig" and a "length" count. Stack-slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3720
  // offsets are based on outgoing arguments, i.e. a CALLER setting up
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3721
  // arguments for a CALLEE. Incoming stack arguments are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3722
  // automatically biased by the preserve_stack_slots field above.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3723
  c_calling_convention %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3724
    // This is obviously always outgoing.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3725
    // C argument in register AND stack slot.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3726
    (void) SharedRuntime::c_calling_convention(sig_bt, regs, /*regs2=*/NULL, length);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3727
  %}
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
  // Location of native (C/C++) and interpreter return values. This
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3730
  // 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
  3731
  // values are actually returned from native calls in O0:O1 and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3732
  // returned to the interpreter in I0:I1. The copying to and from
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3733
  // the register pairs is done by the appropriate call and epilog
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3734
  // opcodes. This simplifies the register allocator.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3735
  c_return_value %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3736
    assert((ideal_reg >= Op_RegI && ideal_reg <= Op_RegL) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3737
            (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
  3738
            "only return normal values");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3739
    // 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
  3740
    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
  3741
    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
  3742
    return OptoRegPair(typeToRegHi[ideal_reg], typeToRegLo[ideal_reg]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3743
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3744
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3745
  // Location of compiled Java return values.  Same as C
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3746
  return_value %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3747
    assert((ideal_reg >= Op_RegI && ideal_reg <= Op_RegL) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3748
            (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
  3749
            "only return normal values");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3750
    // 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
  3751
    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
  3752
    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
  3753
    return OptoRegPair(typeToRegHi[ideal_reg], typeToRegLo[ideal_reg]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3754
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3755
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3756
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3757
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3758
//----------ATTRIBUTES---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3759
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3760
//----------Operand Attributes-------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3761
op_attrib op_cost(1);          // Required cost attribute.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3762
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3763
//----------Instruction Attributes---------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3764
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3765
// Cost attribute. required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3766
ins_attrib ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3767
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3768
// Is this instruction a non-matching short branch variant of some
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3769
// long branch? Not required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3770
ins_attrib ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3771
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3772
ins_attrib ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3773
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3774
// Number of constants.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3775
// This instruction uses the given number of constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3776
// (optional attribute).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3777
// This is needed to determine in time whether the constant pool will
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3778
// exceed 4000 entries. Before postalloc_expand the overall number of constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3779
// is determined. It's also used to compute the constant pool size
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3780
// in Output().
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3781
ins_attrib ins_num_consts(0);
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
// Required alignment attribute (must be a power of 2) specifies the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3784
// alignment that some part of the instruction (not necessarily the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3785
// start) requires. If > 1, a compute_padding() function must be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3786
// provided for the instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3787
ins_attrib ins_alignment(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3788
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3789
// Enforce/prohibit rematerializations.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3790
// - If an instruction is attributed with 'ins_cannot_rematerialize(true)'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3791
//   then rematerialization of that instruction is prohibited and the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3792
//   instruction's value will be spilled if necessary.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3793
//   Causes that MachNode::rematerialize() returns false.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3794
// - If an instruction is attributed with 'ins_should_rematerialize(true)'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3795
//   then rematerialization should be enforced and a copy of the instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3796
//   should be inserted if possible; rematerialization is not guaranteed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3797
//   Note: this may result in rematerializations in front of every use.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3798
//   Causes that MachNode::rematerialize() can return true.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3799
// (optional attribute)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3800
ins_attrib ins_cannot_rematerialize(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3801
ins_attrib ins_should_rematerialize(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3802
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3803
// Instruction has variable size depending on alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3804
ins_attrib ins_variable_size_depending_on_alignment(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3805
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3806
// Instruction is a nop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3807
ins_attrib ins_is_nop(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3808
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3809
// Instruction is mapped to a MachIfFastLock node (instead of MachFastLock).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3810
ins_attrib ins_use_mach_if_fast_lock_node(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3811
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3812
// Field for the toc offset of a constant.
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
// 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
  3815
// 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
  3816
// 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
  3817
// With postalloc expand, we get two nodes that require the same offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3818
// 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
  3819
// when the constant is added to the constant pool during emitting.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3820
// 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
  3821
// 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
  3822
// the offset from there when it gets encoded.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3823
ins_attrib ins_field_const_toc_offset(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3824
ins_attrib ins_field_const_toc_offset_hi_node(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3825
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3826
// A field that can hold the instructions offset in the code buffer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3827
// Set in the nodes emitter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3828
ins_attrib ins_field_cbuf_insts_offset(-1);
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
// Fields for referencing a call's load-IC-node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3831
// 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
  3832
// use two nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3833
ins_attrib ins_field_load_ic_hi_node(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3834
ins_attrib ins_field_load_ic_node(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3835
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3836
//----------OPERANDS-----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3837
// Operand definitions must precede instruction definitions for correct
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3838
// parsing in the ADLC because operands constitute user defined types
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3839
// which are used in instruction definitions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3840
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3841
// Formats are generated automatically for constants and base registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3842
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3843
//----------Simple Operands----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3844
// Immediate Operands
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3845
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3846
// Integer Immediate: 32-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3847
operand immI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3848
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3849
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3850
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3851
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3852
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3853
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3854
operand immI8() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3855
  predicate(Assembler::is_simm(n->get_int(), 8));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3856
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3857
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3858
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3859
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3860
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3862
// Integer Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3863
operand immI16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3864
  predicate(Assembler::is_simm(n->get_int(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3865
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3866
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3867
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3868
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3869
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3870
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3871
// Integer Immediate: 32-bit, where lowest 16 bits are 0x0000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3872
operand immIhi16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3873
  predicate(((n->get_int() & 0xffff0000) != 0) && ((n->get_int() & 0xffff) == 0));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3874
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3875
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3876
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3877
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3878
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3879
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3880
operand immInegpow2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3881
  predicate(is_power_of_2_long((jlong) (julong) (juint) (-(n->get_int()))));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3882
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3883
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3884
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3885
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3886
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3887
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3888
operand immIpow2minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3889
  predicate(is_power_of_2_long((((jlong) (n->get_int()))+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3890
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3891
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3892
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3893
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3896
operand immIpowerOf2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3897
  predicate(is_power_of_2_long((((jlong) (julong) (juint) (n->get_int())))));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3898
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3899
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3900
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3901
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3902
%}
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
// Unsigned Integer Immediate: the values 0-31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3905
operand uimmI5() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3906
  predicate(Assembler::is_uimm(n->get_int(), 5));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3907
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3908
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3909
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3910
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3913
// Unsigned Integer Immediate: 6-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3914
operand uimmI6() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3915
  predicate(Assembler::is_uimm(n->get_int(), 6));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3916
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3917
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3918
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3919
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3920
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3921
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3922
// Unsigned Integer Immediate:  6-bit int, greater than 32
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3923
operand uimmI6_ge32() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3924
  predicate(Assembler::is_uimm(n->get_int(), 6) && n->get_int() >= 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3925
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3926
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3927
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3928
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3931
// Unsigned Integer Immediate: 15-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3932
operand uimmI15() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3933
  predicate(Assembler::is_uimm(n->get_int(), 15));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3934
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3935
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3936
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3937
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3940
// Unsigned Integer Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3941
operand uimmI16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3942
  predicate(Assembler::is_uimm(n->get_int(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3943
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3944
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3945
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3946
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3947
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3948
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3949
// constant 'int 0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3950
operand immI_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3951
  predicate(n->get_int() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3952
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3953
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3954
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3955
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3956
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3957
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3958
// constant 'int 1'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3959
operand immI_1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3960
  predicate(n->get_int() == 1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3961
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3962
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3963
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3964
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3965
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3966
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3967
// constant 'int -1'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3968
operand immI_minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3969
  predicate(n->get_int() == -1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3970
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3971
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3972
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3973
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3974
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3975
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3976
// int value 16.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3977
operand immI_16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3978
  predicate(n->get_int() == 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3979
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3980
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3981
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3982
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3983
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3984
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3985
// int value 24.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3986
operand immI_24() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3987
  predicate(n->get_int() == 24);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3988
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3989
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3990
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3991
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3994
// Compressed oops constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3995
// Pointer Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3996
operand immN() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3997
  match(ConN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3998
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3999
  op_cost(10);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4000
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4001
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4004
// NULL Pointer Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4005
operand immN_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4006
  predicate(n->get_narrowcon() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4007
  match(ConN);
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
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4010
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4011
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4012
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4013
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4014
// Compressed klass constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4015
operand immNKlass() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4016
  match(ConNKlass);
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
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4019
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4020
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4021
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4022
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4023
// This operand can be used to avoid matching of an instruct
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4024
// with chain rule.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4025
operand immNKlass_NM() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4026
  match(ConNKlass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4027
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4028
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4029
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4030
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4031
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4032
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4033
// Pointer Immediate: 64-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4034
operand immP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4035
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4036
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4037
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4038
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4039
%}
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
// Operand to avoid match of loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4042
// This operand can be used to avoid matching of an instruct
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4043
// with chain rule.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4044
operand immP_NM() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4045
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4046
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4047
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4048
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4049
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4050
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4051
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4052
// costant 'pointer 0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4053
operand immP_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4054
  predicate(n->get_ptr() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4055
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4056
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4057
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4058
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4059
%}
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
// pointer 0x0 or 0x1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4062
operand immP_0or1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4063
  predicate((n->get_ptr() == 0) || (n->get_ptr() == 1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4064
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4065
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4066
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4067
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4068
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4069
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4070
operand immL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4071
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4072
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4073
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4074
  interface(CONST_INTER);
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
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4077
operand immLmax30() %{
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4078
  predicate((n->get_long() <= 30));
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4079
  match(ConL);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4080
  op_cost(0);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4081
  format %{ %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4082
  interface(CONST_INTER);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4083
%}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4084
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4085
// Long Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4086
operand immL16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4087
  predicate(Assembler::is_simm(n->get_long(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4088
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4089
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4090
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4091
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4092
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4093
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4094
// Long Immediate: 16-bit, 4-aligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4095
operand immL16Alg4() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4096
  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
  4097
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4098
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4099
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4100
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4101
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4102
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4103
// Long Immediate: 32-bit, where lowest 16 bits are 0x0000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4104
operand immL32hi16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4105
  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
  4106
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4107
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4108
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4109
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4110
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4111
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4112
// Long Immediate: 32-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4113
operand immL32() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4114
  predicate(Assembler::is_simm(n->get_long(), 32));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4115
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4116
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4117
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4118
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4119
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4120
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4121
// Long Immediate: 64-bit, where highest 16 bits are not 0x0000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4122
operand immLhighest16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4123
  predicate((n->get_long() & 0xffff000000000000L) != 0L && (n->get_long() & 0x0000ffffffffffffL) == 0L);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4124
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4125
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4126
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4127
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4128
%}
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
operand immLnegpow2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4131
  predicate(is_power_of_2_long((jlong)-(n->get_long())));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4132
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4133
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4134
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4135
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4136
%}
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
operand immLpow2minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4139
  predicate(is_power_of_2_long((((jlong) (n->get_long()))+1)) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4140
            (n->get_long() != (jlong)0xffffffffffffffffL));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4141
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4142
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4143
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4144
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4145
%}
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
// constant 'long 0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4148
operand immL_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4149
  predicate(n->get_long() == 0L);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4150
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4151
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4152
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4153
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4154
%}
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
// constat ' long -1'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4157
operand immL_minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4158
  predicate(n->get_long() == -1L);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4159
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4160
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4161
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4162
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4163
%}
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
// Long Immediate: low 32-bit mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4166
operand immL_32bits() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4167
  predicate(n->get_long() == 0xFFFFFFFFL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4168
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4169
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4170
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4171
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4172
%}
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
// Unsigned Long Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4175
operand uimmL16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4176
  predicate(Assembler::is_uimm(n->get_long(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4177
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4178
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4179
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4180
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4181
%}
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
// Float Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4184
operand immF() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4185
  match(ConF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4186
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4187
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4188
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4189
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4190
29581
b8d83fef0c8e 8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents: 28954
diff changeset
  4191
// Float Immediate: +0.0f.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4192
operand immF_0() %{
29581
b8d83fef0c8e 8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents: 28954
diff changeset
  4193
  predicate(jint_cast(n->getf()) == 0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4194
  match(ConF);
29581
b8d83fef0c8e 8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents: 28954
diff changeset
  4195
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4196
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4197
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4198
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4199
%}
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
// Double Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4202
operand immD() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4203
  match(ConD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4204
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4205
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4206
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4207
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4208
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4209
// Integer Register Operands
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4210
// Integer Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4211
// See definition of reg_class bits32_reg_rw.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4212
operand iRegIdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4213
  constraint(ALLOC_IN_RC(bits32_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4214
  match(RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4215
  match(rscratch1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4216
  match(rscratch2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4217
  match(rarg1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4218
  match(rarg2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4219
  match(rarg3RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4220
  match(rarg4RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4221
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4222
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4223
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4224
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4225
// Integer Source Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4226
// See definition of reg_class bits32_reg_ro.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4227
operand iRegIsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4228
  constraint(ALLOC_IN_RC(bits32_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4229
  match(RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4230
  match(rscratch1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4231
  match(rscratch2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4232
  match(rarg1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4233
  match(rarg2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4234
  match(rarg3RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4235
  match(rarg4RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4236
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4237
  interface(REG_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4240
operand rscratch1RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4241
  constraint(ALLOC_IN_RC(rscratch1_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4242
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4243
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4244
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4245
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4246
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4247
operand rscratch2RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4248
  constraint(ALLOC_IN_RC(rscratch2_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4249
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4250
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4251
  interface(REG_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4254
operand rarg1RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4255
  constraint(ALLOC_IN_RC(rarg1_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4256
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4257
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4258
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4259
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4260
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4261
operand rarg2RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4262
  constraint(ALLOC_IN_RC(rarg2_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4263
  match(iRegIdst);
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(REG_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
operand rarg3RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4269
  constraint(ALLOC_IN_RC(rarg3_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4270
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4271
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4272
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4273
%}
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
operand rarg4RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4276
  constraint(ALLOC_IN_RC(rarg4_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4277
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4278
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4279
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4280
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4281
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4282
operand rarg1RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4283
  constraint(ALLOC_IN_RC(rarg1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4284
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4285
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4286
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4287
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4288
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4289
operand rarg2RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4290
  constraint(ALLOC_IN_RC(rarg2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4291
  match(iRegLdst);
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(REG_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
operand rarg3RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4297
  constraint(ALLOC_IN_RC(rarg3_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4298
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4299
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4300
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4301
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4302
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4303
operand rarg4RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4304
  constraint(ALLOC_IN_RC(rarg4_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4305
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4306
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4307
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4308
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4309
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4310
// Pointer Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4311
// See definition of reg_class bits64_reg_rw.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4312
operand iRegPdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4313
  constraint(ALLOC_IN_RC(bits64_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4314
  match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4315
  match(rscratch1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4316
  match(rscratch2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4317
  match(rarg1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4318
  match(rarg2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4319
  match(rarg3RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4320
  match(rarg4RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4321
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4322
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4323
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4324
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4325
// Pointer Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4326
// Operand not using r11 and r12 (killed in epilog).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4327
operand iRegPdstNoScratch() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4328
  constraint(ALLOC_IN_RC(bits64_reg_leaf_call));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4329
  match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4330
  match(rarg1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4331
  match(rarg2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4332
  match(rarg3RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4333
  match(rarg4RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4334
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4335
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4336
%}
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
// Pointer Source Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4339
// See definition of reg_class bits64_reg_ro.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4340
operand iRegPsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4341
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4342
  match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4343
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4344
  match(rscratch1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4345
  match(rscratch2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4346
  match(rarg1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4347
  match(rarg2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4348
  match(rarg3RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4349
  match(rarg4RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4350
  match(threadRegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4351
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4352
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4353
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4354
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4355
// Thread operand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4356
operand threadRegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4357
  constraint(ALLOC_IN_RC(thread_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4358
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4359
  format %{ "R16" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4360
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4361
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4362
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4363
operand rscratch1RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4364
  constraint(ALLOC_IN_RC(rscratch1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4365
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4366
  format %{ "R11" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4367
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4368
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4369
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4370
operand rscratch2RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4371
  constraint(ALLOC_IN_RC(rscratch2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4372
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4373
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4374
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4375
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4376
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4377
operand rarg1RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4378
  constraint(ALLOC_IN_RC(rarg1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4379
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4380
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4381
  interface(REG_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4384
operand rarg2RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4385
  constraint(ALLOC_IN_RC(rarg2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4386
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4387
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4388
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4389
%}
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
operand rarg3RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4392
  constraint(ALLOC_IN_RC(rarg3_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4393
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4394
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4395
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4396
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4397
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4398
operand rarg4RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4399
  constraint(ALLOC_IN_RC(rarg4_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4400
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4401
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4402
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4403
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4404
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4405
operand iRegNsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4406
  constraint(ALLOC_IN_RC(bits32_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4407
  match(RegN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4408
  match(iRegNdst);
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
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4411
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4412
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4413
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4414
operand iRegNdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4415
  constraint(ALLOC_IN_RC(bits32_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4416
  match(RegN);
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
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4419
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4420
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4421
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4422
// Long Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4423
// See definition of reg_class bits64_reg_rw.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4424
operand iRegLdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4425
  constraint(ALLOC_IN_RC(bits64_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4426
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4427
  match(rscratch1RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4428
  match(rscratch2RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4429
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4430
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4431
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4432
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4433
// Long Source Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4434
// See definition of reg_class bits64_reg_ro.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4435
operand iRegLsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4436
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4437
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4438
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4439
  match(rscratch1RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4440
  match(rscratch2RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4441
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4442
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4443
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4444
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4445
// Special operand for ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4446
operand iRegL2Isrc(iRegLsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4447
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4448
  match(ConvL2I reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4449
  format %{ "ConvL2I($reg)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4450
  interface(REG_INTER)
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4453
operand rscratch1RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4454
  constraint(ALLOC_IN_RC(rscratch1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4455
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4456
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4457
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4458
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4459
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4460
operand rscratch2RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4461
  constraint(ALLOC_IN_RC(rscratch2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4462
  match(RegL);
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
// Condition Code Flag Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4468
operand flagsReg() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4469
  constraint(ALLOC_IN_RC(int_flags));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4470
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4471
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4472
  interface(REG_INTER);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4475
operand flagsRegSrc() %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4476
  constraint(ALLOC_IN_RC(int_flags_ro));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4477
  match(RegFlags);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4478
  match(flagsReg);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4479
  match(flagsRegCR0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4480
  format %{ %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4481
  interface(REG_INTER);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4482
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4483
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4484
// Condition Code Flag Register CR0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4485
operand flagsRegCR0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4486
  constraint(ALLOC_IN_RC(int_flags_CR0));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4487
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4488
  format %{ "CR0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4489
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4490
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4491
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4492
operand flagsRegCR1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4493
  constraint(ALLOC_IN_RC(int_flags_CR1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4494
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4495
  format %{ "CR1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4496
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4497
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4498
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4499
operand flagsRegCR6() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4500
  constraint(ALLOC_IN_RC(int_flags_CR6));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4501
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4502
  format %{ "CR6" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4503
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4504
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4505
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4506
operand regCTR() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4507
  constraint(ALLOC_IN_RC(ctr_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4508
  // RegFlags should work. Introducing a RegSpecial type would cause a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4509
  // lot of changes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4510
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4511
  format %{"SR_CTR" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4512
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4513
%}
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
operand regD() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4516
  constraint(ALLOC_IN_RC(dbl_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4517
  match(RegD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4518
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4519
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4520
%}
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
operand regF() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4523
  constraint(ALLOC_IN_RC(flt_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4524
  match(RegF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4525
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4526
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4527
%}
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
// Special Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4530
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4531
// Method Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4532
operand inline_cache_regP(iRegPdst reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4533
  constraint(ALLOC_IN_RC(r19_bits64_reg)); // inline_cache_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4534
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4535
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4536
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4537
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4538
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4539
operand compiler_method_oop_regP(iRegPdst reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4540
  constraint(ALLOC_IN_RC(rscratch1_bits64_reg)); // compiler_method_oop_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4541
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4542
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4543
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4544
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4545
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4546
operand interpreter_method_oop_regP(iRegPdst reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4547
  constraint(ALLOC_IN_RC(r19_bits64_reg)); // interpreter_method_oop_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4548
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4549
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4550
  interface(REG_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4553
// Operands to remove register moves in unscaled mode.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4554
// 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
  4555
operand iRegP2N(iRegPsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4556
  predicate(false /* TODO: PPC port MatchDecodeNodes*/&& Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4557
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4558
  match(EncodeP reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4559
  format %{ "$reg" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4560
  interface(REG_INTER)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4561
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4562
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4563
operand iRegN2P(iRegNsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4564
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4565
  constraint(ALLOC_IN_RC(bits32_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4566
  match(DecodeN reg);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4567
  format %{ "$reg" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4568
  interface(REG_INTER)
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4569
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4570
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4571
operand iRegN2P_klass(iRegNsrc reg) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4572
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4573
  constraint(ALLOC_IN_RC(bits32_reg_ro));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4574
  match(DecodeNKlass reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4575
  format %{ "$reg" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4576
  interface(REG_INTER)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4577
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4578
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4579
//----------Complex Operands---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4580
// Indirect Memory Reference
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4581
operand indirect(iRegPsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4582
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4583
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4584
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4585
  format %{ "[$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4586
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4587
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4588
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4589
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4590
    disp(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4591
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4592
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4593
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4594
// Indirect with Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4595
operand indOffset16(iRegPsrc reg, immL16 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4596
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4597
  match(AddP reg offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4598
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4599
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4600
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4601
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4602
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4603
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4604
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4605
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4606
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4607
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4608
// Indirect with 4-aligned Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4609
operand indOffset16Alg4(iRegPsrc reg, immL16Alg4 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4610
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4611
  match(AddP reg offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4612
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4613
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4614
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4615
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4616
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4617
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4618
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4619
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4620
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4621
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4622
//----------Complex Operands for Compressed OOPs-------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4623
// Compressed OOPs with narrow_oop_shift == 0.
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
// Indirect Memory Reference, compressed OOP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4626
operand indirectNarrow(iRegNsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4627
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4628
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4629
  match(DecodeN reg);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4630
  op_cost(100);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4631
  format %{ "[$reg]" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4632
  interface(MEMORY_INTER) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4633
    base($reg);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4634
    index(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4635
    scale(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4636
    disp(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4637
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4638
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4639
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4640
operand indirectNarrow_klass(iRegNsrc reg) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4641
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4642
  constraint(ALLOC_IN_RC(bits64_reg_ro));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4643
  match(DecodeNKlass reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4644
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4645
  format %{ "[$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4646
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4647
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4648
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4649
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4650
    disp(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4651
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4652
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4653
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4654
// Indirect with Offset, compressed OOP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4655
operand indOffset16Narrow(iRegNsrc reg, immL16 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4656
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4657
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4658
  match(AddP (DecodeN reg) offset);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4659
  op_cost(100);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4660
  format %{ "[$reg + $offset]" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4661
  interface(MEMORY_INTER) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4662
    base($reg);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4663
    index(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4664
    scale(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4665
    disp($offset);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4666
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4667
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4668
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4669
operand indOffset16Narrow_klass(iRegNsrc reg, immL16 offset) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4670
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4671
  constraint(ALLOC_IN_RC(bits64_reg_ro));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4672
  match(AddP (DecodeNKlass reg) offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4673
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4674
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4675
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4676
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4677
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4678
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4679
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4680
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4681
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4682
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4683
// Indirect with 4-aligned Offset, compressed OOP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4684
operand indOffset16NarrowAlg4(iRegNsrc reg, immL16Alg4 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4685
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4686
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4687
  match(AddP (DecodeN reg) offset);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4688
  op_cost(100);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4689
  format %{ "[$reg + $offset]" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4690
  interface(MEMORY_INTER) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4691
    base($reg);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4692
    index(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4693
    scale(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4694
    disp($offset);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4695
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4696
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4697
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4698
operand indOffset16NarrowAlg4_klass(iRegNsrc reg, immL16Alg4 offset) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4699
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4700
  constraint(ALLOC_IN_RC(bits64_reg_ro));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4701
  match(AddP (DecodeNKlass reg) offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4702
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4703
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4704
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4705
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4706
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4707
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4708
    disp($offset);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4711
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4712
//----------Special Memory Operands--------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4713
// Stack Slot Operand
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4714
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4715
// This operand is used for loading and storing temporary values on
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4716
// the stack where a match requires a value to flow through memory.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4717
operand stackSlotI(sRegI reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4718
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4719
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4720
  //match(RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4721
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4722
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4723
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4724
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4725
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4726
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4727
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4728
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4729
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4730
operand stackSlotL(sRegL reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4731
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4732
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4733
  //match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4734
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4735
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4736
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4737
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4738
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4739
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4740
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4741
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4742
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4743
operand stackSlotP(sRegP reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4744
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4745
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4746
  //match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4747
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4748
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4749
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4750
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4751
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4752
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4753
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4754
%}
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
operand stackSlotF(sRegF reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4757
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4758
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4759
  //match(RegF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4760
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4761
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4762
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4763
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4764
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4765
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4766
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4767
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4768
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4769
operand stackSlotD(sRegD reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4770
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4771
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4772
  //match(RegD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4773
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4774
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4775
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4776
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4777
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4778
    disp($reg);  // Stack Offset
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4782
// Operands for expressing Control Flow
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4783
// NOTE: Label is a predefined operand which should not be redefined in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4784
//       the AD file. It is generically handled within the ADLC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4785
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4786
//----------Conditional Branch Operands----------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4787
// Comparison Op
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
// This is the operation of the comparison, and is limited to the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4790
// following set of codes: L (<), LE (<=), G (>), GE (>=), E (==), NE
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4791
// (!=).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4792
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4793
// Other attributes of the comparison, such as unsignedness, are specified
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4794
// by the comparison instruction that sets a condition code flags register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4795
// That result is represented by a flags operand whose subtype is appropriate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4796
// to the unsignedness (etc.) of the comparison.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4797
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4798
// Later, the instruction which matches both the Comparison Op (a Bool) and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4799
// 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
  4800
// by matching a specific subtype of Bool operand below.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4801
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4802
// When used for floating point comparisons: unordered same as less.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4803
operand cmpOp() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4804
  match(Bool);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4805
  format %{ "" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4806
  interface(COND_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4807
                           // 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
  4808
                           //           BO          &  BI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4809
    equal(0xA);            // 10 10:   bcondCRbiIs1 & Condition::equal
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4810
    not_equal(0x2);        // 00 10:   bcondCRbiIs0 & Condition::equal
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4811
    less(0x8);             // 10 00:   bcondCRbiIs1 & Condition::less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4812
    greater_equal(0x0);    // 00 00:   bcondCRbiIs0 & Condition::less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4813
    less_equal(0x1);       // 00 01:   bcondCRbiIs0 & Condition::greater
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4814
    greater(0x9);          // 10 01:   bcondCRbiIs1 & Condition::greater
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4815
    overflow(0xB);         // 10 11:   bcondCRbiIs1 & Condition::summary_overflow
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4816
    no_overflow(0x3);      // 00 11:   bcondCRbiIs0 & Condition::summary_overflow
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4820
//----------OPERAND CLASSES----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4821
// Operand Classes are groups of operands that are used to simplify
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4822
// instruction definitions by not requiring the AD writer to specify
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4823
// seperate instructions for every form of operand when the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4824
// instruction accepts multiple operand types with the same basic
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4825
// encoding and format. The classic case of this is memory operands.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4826
// Indirect is not included since its use is limited to Compare & Swap.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4827
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4828
opclass memory(indirect, indOffset16 /*, indIndex, tlsReference*/, indirectNarrow, indirectNarrow_klass, indOffset16Narrow, indOffset16Narrow_klass);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4829
// Memory operand where offsets are 4-aligned. Required for ld, std.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4830
opclass memoryAlg4(indirect, indOffset16Alg4, indirectNarrow, indOffset16NarrowAlg4, indOffset16NarrowAlg4_klass);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4831
opclass indirectMemory(indirect, indirectNarrow);
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
// Special opclass for I and ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4834
opclass iRegIsrc_iRegL2Isrc(iRegIsrc, iRegL2Isrc);
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
// Operand classes to match encode and decode. iRegN_P2N is only used
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4837
// for storeN. I have never seen an encode node elsewhere.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4838
opclass iRegN_P2N(iRegNsrc, iRegP2N);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4839
opclass iRegP_N2P(iRegPsrc, iRegN2P, iRegN2P_klass);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4840
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4841
//----------PIPELINE-----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4842
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4843
pipeline %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4844
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4845
// See J.M.Tendler et al. "Power4 system microarchitecture", IBM
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4846
// J. Res. & Dev., No. 1, Jan. 2002.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4847
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4848
//----------ATTRIBUTES---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4849
attributes %{
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
  // Power4 instructions are of fixed length.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4852
  fixed_size_instructions;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4853
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4854
  // TODO: if `bundle' means number of instructions fetched
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4855
  // per cycle, this is 8. If `bundle' means Power4 `group', that is
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4856
  // max instructions issued per cycle, this is 5.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4857
  max_instructions_per_bundle = 8;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4858
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4859
  // A Power4 instruction is 4 bytes long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4860
  instruction_unit_size = 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4862
  // The Power4 processor fetches 64 bytes...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4863
  instruction_fetch_unit_size = 64;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4864
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4865
  // ...in one line
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4866
  instruction_fetch_units = 1
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
  // Unused, list one so that array generated by adlc is not empty.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4869
  // Aix compiler chokes if _nop_count = 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4870
  nops(fxNop);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4871
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4872
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4873
//----------RESOURCES----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4874
// Resources are the functional units available to the machine
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4875
resources(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4876
   PPC_BR,         // branch unit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4877
   PPC_CR,         // condition unit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4878
   PPC_FX1,        // integer arithmetic unit 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4879
   PPC_FX2,        // integer arithmetic unit 2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4880
   PPC_LDST1,      // load/store unit 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4881
   PPC_LDST2,      // load/store unit 2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4882
   PPC_FP1,        // float arithmetic unit 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4883
   PPC_FP2,        // float arithmetic unit 2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4884
   PPC_LDST = PPC_LDST1 | PPC_LDST2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4885
   PPC_FX = PPC_FX1 | PPC_FX2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4886
   PPC_FP = PPC_FP1 | PPC_FP2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4887
 );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4888
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4889
//----------PIPELINE DESCRIPTION-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4890
// Pipeline Description specifies the stages in the machine's pipeline
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4891
pipe_desc(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4892
   // Power4 longest pipeline path
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4893
   PPC_IF,   // instruction fetch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4894
   PPC_IC,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4895
   //PPC_BP, // branch prediction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4896
   PPC_D0,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4897
   PPC_D1,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4898
   PPC_D2,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4899
   PPC_D3,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4900
   PPC_Xfer1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4901
   PPC_GD,   // group definition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4902
   PPC_MP,   // map
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4903
   PPC_ISS,  // issue
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4904
   PPC_RF,   // resource fetch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4905
   PPC_EX1,  // execute (all units)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4906
   PPC_EX2,  // execute (FP, LDST)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4907
   PPC_EX3,  // execute (FP, LDST)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4908
   PPC_EX4,  // execute (FP)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4909
   PPC_EX5,  // execute (FP)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4910
   PPC_EX6,  // execute (FP)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4911
   PPC_WB,   // write back
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4912
   PPC_Xfer2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4913
   PPC_CP
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4916
//----------PIPELINE CLASSES---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4917
// Pipeline Classes describe the stages in which input and output are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4918
// referenced by the hardware pipeline.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4919
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4920
// Simple pipeline classes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4921
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4922
// Default pipeline class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4923
pipe_class pipe_class_default() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4924
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4925
  fixed_latency(2);
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
// Pipeline class for empty instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4929
pipe_class pipe_class_empty() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4930
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4931
  fixed_latency(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4932
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4933
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4934
// Pipeline class for compares.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4935
pipe_class pipe_class_compare() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4936
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4937
  fixed_latency(16);
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
// Pipeline class for traps.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4941
pipe_class pipe_class_trap() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4942
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4943
  fixed_latency(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4944
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4945
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4946
// Pipeline class for memory operations.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4947
pipe_class pipe_class_memory() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4948
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4949
  fixed_latency(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4950
%}
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
// Pipeline class for call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4953
pipe_class pipe_class_call() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4954
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4955
  fixed_latency(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4956
%}
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
// Define the class for the Nop node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4959
define %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4960
   MachNop = pipe_class_default;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4961
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4962
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
//----------INSTRUCTIONS-------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4966
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4967
// Naming of instructions:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4968
//   opA_operB / opA_operB_operC:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4969
//     Operation 'op' with one or two source operands 'oper'. Result
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4970
//     type is A, source operand types are B and C.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4971
//     Iff A == B == C, B and C are left out.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4972
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4973
// The instructions are ordered according to the following scheme:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4974
//  - loads
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4975
//  - load constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4976
//  - prefetch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4977
//  - store
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4978
//  - encode/decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4979
//  - membar
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4980
//  - conditional moves
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4981
//  - compare & swap
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4982
//  - arithmetic and logic operations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4983
//    * int: Add, Sub, Mul, Div, Mod
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4984
//    * int: lShift, arShift, urShift, rot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4985
//    * float: Add, Sub, Mul, Div
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4986
//    * and, or, xor ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4987
//  - register moves: float <-> int, reg <-> stack, repl
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4988
//  - cast (high level type cast, XtoP, castPP, castII, not_null etc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4989
//  - conv (low level type cast requiring bit changes (sign extend etc)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4990
//  - compares, range & zero checks.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4991
//  - branches
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4992
//  - complex operations, intrinsics, min, max, replicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4993
//  - lock
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4994
//  - Calls
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4995
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4996
// If there are similar instructions with different types they are sorted:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4997
// int before float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4998
// small before big
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4999
// signed before unsigned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5000
// e.g., loadS before loadUS before loadI before loadF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5001
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5002
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5003
//----------Load/Store Instructions--------------------------------------------
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
//----------Load Instructions--------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5006
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5007
// Converts byte to int.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5008
// 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
  5009
// reuses the 'amount' operand, but adlc expects that operand specification
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5010
// and operands in match rule are equivalent.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5011
instruct convB2I_reg_2(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5012
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5013
  format %{ "EXTSB   $dst, $src \t// byte->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5014
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5015
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5016
    // TODO: PPC port $archOpcode(ppc64Opcode_extsb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5017
    __ extsb($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5018
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5019
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5020
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5021
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5022
instruct loadUB_indirect(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5023
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5024
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5025
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5026
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5027
  format %{ "LBZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5028
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5029
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5030
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5031
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5032
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5033
instruct loadUB_indirect_ac(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5034
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5035
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5036
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5037
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5038
  format %{ "LBZ     $dst, $mem\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5039
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5040
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5041
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5042
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5043
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5046
// Load Byte (8bit signed). LoadB = LoadUB + ConvUB2B.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5047
instruct loadB_indirect_Ex(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5048
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5049
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5050
  ins_cost(MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5051
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5052
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5053
    loadUB_indirect(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5054
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5055
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5056
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5057
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5058
instruct loadB_indirect_ac_Ex(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5059
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5060
  ins_cost(3*MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5061
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5062
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5063
    loadUB_indirect_ac(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5064
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5065
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5066
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5067
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5068
instruct loadUB_indOffset16(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5069
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5070
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5071
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5072
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5073
  format %{ "LBZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5074
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5075
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5076
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5077
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5078
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5079
instruct loadUB_indOffset16_ac(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5080
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5081
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5082
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5083
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5084
  format %{ "LBZ     $dst, $mem\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5085
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5086
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5087
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5088
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5089
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5090
%}
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
// Load Byte (8bit signed). LoadB = LoadUB + ConvUB2B.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5093
instruct loadB_indOffset16_Ex(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5094
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5095
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5096
  ins_cost(MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5097
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5098
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5099
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5100
    loadUB_indOffset16(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5101
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5102
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5103
%}
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
instruct loadB_indOffset16_ac_Ex(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5106
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5107
  ins_cost(3*MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5108
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5109
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5110
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5111
    loadUB_indOffset16_ac(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5112
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5113
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5114
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5115
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5116
// Load Unsigned Byte (8bit UNsigned) into an int reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5117
instruct loadUB(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5118
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5119
  match(Set dst (LoadUB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5120
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5121
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5122
  format %{ "LBZ     $dst, $mem \t// byte, zero-extend to int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5123
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5124
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5125
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5126
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5127
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5128
// Load  Unsigned Byte (8bit UNsigned) acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5129
instruct loadUB_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5130
  match(Set dst (LoadUB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5131
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5132
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5133
  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
  5134
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5135
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5136
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5137
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5138
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5139
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5140
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5141
// Load Unsigned Byte (8bit UNsigned) into a Long Register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5142
instruct loadUB2L(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5143
  match(Set dst (ConvI2L (LoadUB mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5144
  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
  5145
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5146
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5147
  format %{ "LBZ     $dst, $mem \t// byte, zero-extend to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5148
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5149
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5150
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5151
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5152
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5153
instruct loadUB2L_ac(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5154
  match(Set dst (ConvI2L (LoadUB mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5155
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5156
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5157
  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
  5158
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5159
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5160
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5161
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5162
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5163
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5164
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5165
// Load Short (16bit signed)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5166
instruct loadS(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5167
  match(Set dst (LoadS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5168
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5169
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5170
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5171
  format %{ "LHA     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5172
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5173
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5174
    // TODO: PPC port $archOpcode(ppc64Opcode_lha);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5175
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5176
    __ lha($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5177
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5178
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5179
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5180
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5181
// Load Short (16bit signed) acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5182
instruct loadS_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5183
  match(Set dst (LoadS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5184
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5185
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5186
  format %{ "LHA     $dst, $mem\t acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5187
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5188
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5189
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5190
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5191
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5192
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5193
    __ lha($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5194
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5195
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5196
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5197
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5200
// Load Char (16bit unsigned)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5201
instruct loadUS(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5202
  match(Set dst (LoadUS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5203
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5204
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5205
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5206
  format %{ "LHZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5207
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5208
  ins_encode( enc_lhz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5209
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5210
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5211
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5212
// Load Char (16bit unsigned) acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5213
instruct loadUS_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5214
  match(Set dst (LoadUS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5215
  ins_cost(3*MEMORY_REF_COST);
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
  format %{ "LHZ     $dst, $mem \t// acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5218
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5219
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5220
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5221
  ins_encode( enc_lhz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5222
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5223
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5224
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5225
// Load Unsigned Short/Char (16bit UNsigned) into a Long Register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5226
instruct loadUS2L(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5227
  match(Set dst (ConvI2L (LoadUS mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5228
  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
  5229
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5230
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5231
  format %{ "LHZ     $dst, $mem \t// short, zero-extend to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5232
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5233
  ins_encode( enc_lhz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5234
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5235
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5236
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5237
// Load Unsigned Short/Char (16bit UNsigned) into a Long Register acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5238
instruct loadUS2L_ac(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5239
  match(Set dst (ConvI2L (LoadUS mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5240
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5241
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5242
  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
  5243
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5244
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5245
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5246
  ins_encode( enc_lhz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5247
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5248
%}
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
// Load Integer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5251
instruct loadI(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5252
  match(Set dst (LoadI mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5253
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5254
  ins_cost(MEMORY_REF_COST);
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 %{ "LWZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5257
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5258
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5259
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5260
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5261
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5262
// Load Integer acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5263
instruct loadI_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5264
  match(Set dst (LoadI mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5265
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5266
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5267
  format %{ "LWZ     $dst, $mem \t// load acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5268
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5269
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5270
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5271
  ins_encode( enc_lwz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5272
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5273
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5274
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  5275
// Match loading integer and casting it to unsigned int in
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5276
// long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5277
// LoadI + ConvI2L + AndL 0xffffffff.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5278
instruct loadUI2L(iRegLdst dst, memory mem, immL_32bits mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5279
  match(Set dst (AndL (ConvI2L (LoadI mem)) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5280
  predicate(_kids[0]->_kids[0]->_leaf->as_Load()->is_unordered());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5281
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5282
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5283
  format %{ "LWZ     $dst, $mem \t// zero-extend to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5284
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5285
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5286
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5289
// Match loading integer and casting it to long.
39424
1045973b8c6a 8158260: PPC64: unaligned Unsafe.getInt can lead to the generation of illegal instructions
simonis
parents: 38931
diff changeset
  5290
instruct loadI2L(iRegLdst dst, memoryAlg4 mem) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5291
  match(Set dst (ConvI2L (LoadI mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5292
  predicate(_kids[0]->_leaf->as_Load()->is_unordered());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5293
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5294
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5295
  format %{ "LWA     $dst, $mem \t// loadI2L" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5296
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5297
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5298
    // TODO: PPC port $archOpcode(ppc64Opcode_lwa);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5299
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5300
    __ lwa($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5301
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5302
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5303
%}
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
// Match loading integer and casting it to long - acquire.
39424
1045973b8c6a 8158260: PPC64: unaligned Unsafe.getInt can lead to the generation of illegal instructions
simonis
parents: 38931
diff changeset
  5306
instruct loadI2L_ac(iRegLdst dst, memoryAlg4 mem) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5307
  match(Set dst (ConvI2L (LoadI mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5308
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5309
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5310
  format %{ "LWA     $dst, $mem \t// loadI2L acquire"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5311
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5312
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5313
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5314
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5315
    // TODO: PPC port $archOpcode(ppc64Opcode_lwa);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5316
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5317
    __ lwa($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5318
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5319
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5320
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5321
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5322
%}
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
// Load Long - aligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5325
instruct loadL(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5326
  match(Set dst (LoadL mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5327
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5328
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5329
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5330
  format %{ "LD      $dst, $mem \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5331
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5332
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5333
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5334
%}
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
// Load Long - aligned acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5337
instruct loadL_ac(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5338
  match(Set dst (LoadL mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5339
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5340
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5341
  format %{ "LD      $dst, $mem \t// long acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5342
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5343
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5344
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5345
  ins_encode( enc_ld_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5346
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5347
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5348
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5349
// Load Long - UNaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5350
instruct loadL_unaligned(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5351
  match(Set dst (LoadL_unaligned mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5352
  // predicate(...) // Unaligned_ac is not needed (and wouldn't make sense).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5353
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5354
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5355
  format %{ "LD      $dst, $mem \t// unaligned long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5356
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5357
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5358
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5359
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5360
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5361
// Load nodes for superwords
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5362
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5363
// Load Aligned Packed Byte
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5364
instruct loadV8(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5365
  predicate(n->as_LoadVector()->memory_size() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5366
  match(Set dst (LoadVector mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5367
  ins_cost(MEMORY_REF_COST);
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
  format %{ "LD      $dst, $mem \t// load 8-byte Vector" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5370
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5371
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5372
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5373
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5374
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5375
// Load Range, range = array length (=jint)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5376
instruct loadRange(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5377
  match(Set dst (LoadRange mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5378
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5379
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5380
  format %{ "LWZ     $dst, $mem \t// range" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5381
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5382
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5383
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5384
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5385
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5386
// Load Compressed Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5387
instruct loadN(iRegNdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5388
  match(Set dst (LoadN mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5389
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5390
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5391
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5392
  format %{ "LWZ     $dst, $mem \t// load compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5393
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5394
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5395
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5398
// Load Compressed Pointer acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5399
instruct loadN_ac(iRegNdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5400
  match(Set dst (LoadN mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5401
  ins_cost(3*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 %{ "LWZ     $dst, $mem \t// load acquire compressed ptr\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5404
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5405
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5406
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5407
  ins_encode( enc_lwz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5408
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5409
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5410
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5411
// Load Compressed Pointer and decode it if narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5412
instruct loadN2P_unscaled(iRegPdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5413
  match(Set dst (DecodeN (LoadN mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5414
  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
  5415
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5416
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5417
  format %{ "LWZ     $dst, $mem \t// DecodeN (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5418
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5419
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5420
  ins_pipe(pipe_class_memory);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5423
instruct loadN2P_klass_unscaled(iRegPdst dst, memory mem) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5424
  match(Set dst (DecodeNKlass (LoadNKlass mem)));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5425
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0 &&
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5426
            _kids[0]->_leaf->as_Load()->is_unordered());
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5427
  ins_cost(MEMORY_REF_COST);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5428
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5429
  format %{ "LWZ     $dst, $mem \t// DecodeN (unscaled)" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5430
  size(4);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5431
  ins_encode( enc_lwz(dst, mem) );
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5432
  ins_pipe(pipe_class_memory);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5433
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5434
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5435
// Load Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5436
instruct loadP(iRegPdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5437
  match(Set dst (LoadP mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5438
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5439
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5440
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5441
  format %{ "LD      $dst, $mem \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5442
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5443
  ins_encode( enc_ld(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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5447
// Load Pointer acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5448
instruct loadP_ac(iRegPdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5449
  match(Set dst (LoadP mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5450
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5451
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5452
  format %{ "LD      $dst, $mem \t// ptr acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5453
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5454
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5455
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5456
  ins_encode( enc_ld_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5457
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5458
%}
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
// LoadP + CastP2L
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5461
instruct loadP2X(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5462
  match(Set dst (CastP2X (LoadP mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5463
  predicate(_kids[0]->_leaf->as_Load()->is_unordered());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5464
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5465
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5466
  format %{ "LD      $dst, $mem \t// ptr + p2x" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5467
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5468
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5469
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5470
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5471
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5472
// Load compressed klass pointer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5473
instruct loadNKlass(iRegNdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5474
  match(Set dst (LoadNKlass mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5475
  ins_cost(MEMORY_REF_COST);
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
  format %{ "LWZ     $dst, $mem \t// compressed klass ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5478
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5479
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5480
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5483
// Load Klass Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5484
instruct loadKlass(iRegPdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5485
  match(Set dst (LoadKlass mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5486
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5487
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5488
  format %{ "LD      $dst, $mem \t// klass ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5489
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5490
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5491
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5494
// Load Float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5495
instruct loadF(regF dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5496
  match(Set dst (LoadF mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5497
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5498
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5499
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5500
  format %{ "LFS     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5501
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5502
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5503
    // TODO: PPC port $archOpcode(ppc64Opcode_lfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5504
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5505
    __ lfs($dst$$FloatRegister, Idisp, $mem$$base$$Register);
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
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5508
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5509
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5510
// Load Float acquire.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5511
instruct loadF_ac(regF dst, memory mem, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5512
  match(Set dst (LoadF mem));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5513
  effect(TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5514
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5515
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5516
  format %{ "LFS     $dst, $mem \t// acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5517
            "FCMPU   cr0, $dst, $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5518
            "BNE     cr0, next\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5519
            "next:\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5520
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5521
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5522
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5523
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5524
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5525
    Label next;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5526
    __ lfs($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5527
    __ fcmpu(CCR0, $dst$$FloatRegister, $dst$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5528
    __ bne(CCR0, next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5529
    __ bind(next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5530
    __ isync();
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
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5533
%}
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 Double - aligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5536
instruct loadD(regD dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5537
  match(Set dst (LoadD mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5538
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
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 %{ "LFD     $dst, $mem" %}
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_lfd(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 Double - aligned acquire.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5548
instruct loadD_ac(regD dst, memory mem, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5549
  match(Set dst (LoadD mem));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5550
  effect(TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5551
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5552
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5553
  format %{ "LFD     $dst, $mem \t// acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5554
            "FCMPU   cr0, $dst, $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5555
            "BNE     cr0, next\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5556
            "next:\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5557
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5558
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5559
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5560
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5561
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5562
    Label next;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5563
    __ lfd($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5564
    __ fcmpu(CCR0, $dst$$FloatRegister, $dst$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5565
    __ bne(CCR0, next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5566
    __ bind(next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5567
    __ isync();
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
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5570
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5571
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5572
// Load Double - UNaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5573
instruct loadD_unaligned(regD dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5574
  match(Set dst (LoadD_unaligned mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5575
  // predicate(...) // Unaligned_ac is not needed (and wouldn't make sense).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5576
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5577
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5578
  format %{ "LFD     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5579
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5580
  ins_encode( enc_lfd(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5581
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5584
//----------Constants--------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5585
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5586
// Load MachConstantTableBase: add hi offset to global toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5587
// TODO: Handle hidden register r29 in bundler!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5588
instruct loadToc_hi(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5589
  effect(DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5590
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5591
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5592
  format %{ "ADDIS   $dst, R29, DISP.hi \t// load TOC hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5593
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5594
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5595
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5596
    __ calculate_address_from_global_toc_hi16only($dst$$Register, __ method_toc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5597
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5598
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5599
%}
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
// Load MachConstantTableBase: add lo offset to global toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5602
instruct loadToc_lo(iRegLdst dst, iRegLdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5603
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5604
  ins_cost(DEFAULT_COST);
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
  format %{ "ADDI    $dst, $src, DISP.lo \t// load TOC lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5607
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5608
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5609
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5610
    __ calculate_address_from_global_toc_lo16only($dst$$Register, __ method_toc());
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5613
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5614
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5615
// Load 16-bit integer constant 0xssss????
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5616
instruct loadConI16(iRegIdst dst, immI16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5617
  match(Set dst src);
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
  format %{ "LI      $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5620
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5621
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5622
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5623
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5624
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5625
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5626
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5627
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5628
// Load integer constant 0x????0000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5629
instruct loadConIhi16(iRegIdst dst, immIhi16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5630
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5631
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5632
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5633
  format %{ "LIS     $dst, $src.hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5634
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5635
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5636
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5637
    // 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
  5638
    __ lis($dst$$Register, (int)((short)(($src$$constant & 0xFFFF0000) >> 16)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5639
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5640
  ins_pipe(pipe_class_default);
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
// 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
  5644
// and sign extended), this adds the low 16 bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5645
instruct loadConI32_lo16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5646
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5647
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5648
  predicate(false);
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 %{ "ORI     $dst, $src1.hi, $src2.lo" %}
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 %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5653
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5654
    __ ori($dst$$Register, $src1$$Register, ($src2$$constant) & 0xFFFF);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5657
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5658
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5659
instruct loadConI_Ex(iRegIdst dst, immI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5660
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5661
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5662
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5663
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5664
    // Would like to use $src$$constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5665
    immI16 srcLo %{ _opnds[1]->constant() %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5666
    // srcHi can be 0000 if srcLo sign-extends to a negative number.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5667
    immIhi16 srcHi %{ _opnds[1]->constant() %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5668
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5669
    loadConIhi16(tmpI, srcHi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5670
    loadConI32_lo16(dst, tmpI, srcLo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5671
  %}
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5674
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5675
instruct loadConL16(iRegLdst dst, immL16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5676
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5677
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5678
  format %{ "LI      $dst, $src \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5679
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5680
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5681
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5682
    __ li($dst$$Register, (int)((short) ($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5683
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5684
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5685
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5686
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5687
// Load long constant 0xssssssss????0000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5688
instruct loadConL32hi16(iRegLdst dst, immL32hi16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5689
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5690
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5691
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5692
  format %{ "LIS     $dst, $src.hi \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5693
  size(4);
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_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5696
    __ lis($dst$$Register, (int)((short)(($src$$constant & 0xFFFF0000) >> 16)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5697
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5698
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5699
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5700
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5701
// 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
  5702
// high 16 bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5703
instruct loadConL32_lo16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5704
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5705
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5706
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5707
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5708
  format %{ "ORI     $dst, $src1, $src2.lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5709
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5710
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5711
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5712
    __ ori($dst$$Register, $src1$$Register, ($src2$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5713
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5714
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5715
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5716
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5717
// Load 32-bit long constant
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5718
instruct loadConL32_Ex(iRegLdst dst, immL32 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5719
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5720
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5721
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5722
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5723
    // Would like to use $src$$constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5724
    immL16     srcLo %{ _opnds[1]->constant() /*& 0x0000FFFFL */%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5725
    // srcHi can be 0000 if srcLo sign-extends to a negative number.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5726
    immL32hi16 srcHi %{ _opnds[1]->constant() /*& 0xFFFF0000L */%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5727
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5728
    loadConL32hi16(tmpL, srcHi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5729
    loadConL32_lo16(dst, tmpL, srcLo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5730
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5731
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5732
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5733
// Load long constant 0x????000000000000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5734
instruct loadConLhighest16_Ex(iRegLdst dst, immLhighest16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5735
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5736
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5737
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5738
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5739
    immL32hi16 srcHi %{ _opnds[1]->constant() >> 32 /*& 0xFFFF0000L */%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5740
    immI shift32 %{ 32 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5741
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5742
    loadConL32hi16(tmpL, srcHi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5743
    lshiftL_regL_immI(dst, tmpL, shift32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5744
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5745
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5746
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5747
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5748
instruct loadConL(iRegLdst dst, immL src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5749
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5750
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5751
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5752
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5753
  // Needed so that CallDynamicJavaDirect can compute the address of this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5754
  // instruction for relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5755
  ins_field_cbuf_insts_offset(int);
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
  format %{ "LD      $dst, offset, $toc \t// load long $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5758
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5759
  ins_encode( enc_load_long_constL(dst, src, toc) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5760
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5761
%}
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
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5764
instruct loadConL_hi(iRegLdst dst, immL src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5765
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5766
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5767
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5768
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5769
  ins_field_const_toc_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5770
  // Needed so that CallDynamicJavaDirect can compute the address of this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5771
  // instruction for relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5772
  ins_field_cbuf_insts_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5773
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5774
  format %{ "ADDIS   $dst, $toc, offset \t// load long $src from TOC (hi)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5775
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5776
  ins_encode( enc_load_long_constL_hi(dst, toc, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5777
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5778
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5779
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5780
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5781
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5782
instruct loadConL_lo(iRegLdst dst, immL src, iRegLdst base) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5783
  effect(DEF dst, USE src, USE base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5784
  predicate(false);
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
  ins_field_const_toc_offset_hi_node(loadConL_hiNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5787
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5788
  format %{ "LD      $dst, offset, $base \t// load long $src from TOC (lo)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5789
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5790
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5791
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5792
    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
  5793
    __ ld($dst$$Register, MacroAssembler::largeoffset_si16_si16_lo(offset), $base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5794
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5795
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5796
%}
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
// Load long constant from constant table. Expand in case of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5799
// offset > 16 bit is needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5800
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5801
instruct loadConL_Ex(iRegLdst dst, immL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5802
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5803
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5804
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5805
  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
  5806
  // 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
  5807
  postalloc_expand( postalloc_expand_load_long_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5808
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5809
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5810
// Load NULL as compressed oop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5811
instruct loadConN0(iRegNdst dst, immN_0 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5812
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5813
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5814
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5815
  format %{ "LI      $dst, $src \t// compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5816
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5817
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5818
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5819
    __ li($dst$$Register, 0);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5822
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5823
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5824
// Load hi part of compressed oop constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5825
instruct loadConN_hi(iRegNdst dst, immN src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5826
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5827
  ins_cost(DEFAULT_COST);
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
  format %{ "LIS     $dst, $src \t// narrow oop hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5830
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5831
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5832
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5833
    __ lis($dst$$Register, (int)(short)(($src$$constant >> 16) & 0xffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5834
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5835
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5836
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5837
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5838
// Add lo part of compressed oop constant to already loaded hi part.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5839
instruct loadConN_lo(iRegNdst dst, iRegNsrc src1, immN src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5840
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5841
  ins_cost(DEFAULT_COST);
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
  format %{ "ORI     $dst, $src1, $src2 \t// narrow oop lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5844
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5845
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5846
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5847
    assert(__ oop_recorder() != NULL, "this assembler needs an OopRecorder");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5848
    int oop_index = __ oop_recorder()->find_index((jobject)$src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5849
    RelocationHolder rspec = oop_Relocation::spec(oop_index);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5850
    __ relocate(rspec, 1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5851
    __ ori($dst$$Register, $src1$$Register, $src2$$constant & 0xffff);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5852
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5853
  ins_pipe(pipe_class_default);
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
46521
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5856
instruct rldicl(iRegLdst dst, iRegLsrc src, immI16 shift, immI16 mask_begin) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5857
  effect(DEF dst, USE src, USE shift, USE mask_begin);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5858
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5859
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5860
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5861
    __ rldicl($dst$$Register, $src$$Register, $shift$$constant, $mask_begin$$constant);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5862
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5863
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5864
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  5865
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5866
// Needed to postalloc expand loadConN: ConN is loaded as ConI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5867
// leaving the upper 32 bits with sign-extension bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5868
// This clears these bits: dst = src & 0xFFFFFFFF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5869
// TODO: Eventually call this maskN_regN_FFFFFFFF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5870
instruct clearMs32b(iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5871
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5872
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5873
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5874
  format %{ "MASK    $dst, $src, 0xFFFFFFFF" %} // mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5875
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5876
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5877
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5878
    __ clrldi($dst$$Register, $src$$Register, 0x20);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5879
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5880
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5881
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5882
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  5883
// Optimize DecodeN for disjoint base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  5884
// Load base of compressed oops into a register
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  5885
instruct loadBase(iRegLdst dst) %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  5886
  effect(DEF dst);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  5887
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5888
  format %{ "LoadConst $dst, heapbase" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5889
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5890
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5891
    __ load_const_optimized($dst$$Register, Universe::narrow_oop_base(), R0);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  5892
  %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  5893
  ins_pipe(pipe_class_default);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  5894
%}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  5895
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5896
// Loading ConN must be postalloc expanded so that edges between
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5897
// the nodes are safe. They may not interfere with a safepoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5898
// 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
  5899
instruct loadConN_Ex(iRegNdst dst, immN src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5900
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5901
  ins_cost(DEFAULT_COST*2);
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
  format %{ "LoadN   $dst, $src \t// postalloc expanded" %} // mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5904
  postalloc_expand %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  5905
    MachNode *m1 = new loadConN_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  5906
    MachNode *m2 = new loadConN_loNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  5907
    MachNode *m3 = new clearMs32bNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5908
    m1->add_req(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5909
    m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5910
    m3->add_req(NULL, m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5911
    m1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5912
    m1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5913
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5914
    m2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5915
    m2->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5916
    m3->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5917
    m3->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5918
    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
  5919
    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
  5920
    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
  5921
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5922
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5923
    nodes->push(m3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5924
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5925
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5926
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5927
// We have seen a safepoint between the hi and lo parts, and this node was handled
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5928
// as an oop. Therefore this needs a match rule so that build_oop_map knows this is
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5929
// not a narrow oop.
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5930
instruct loadConNKlass_hi(iRegNdst dst, immNKlass_NM src) %{
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5931
  match(Set dst src);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5932
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5933
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5934
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5935
  format %{ "LIS     $dst, $src \t// narrow klass hi" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5936
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5937
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5938
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5939
    intptr_t Csrc = Klass::encode_klass((Klass *)$src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5940
    __ lis($dst$$Register, (int)(short)((Csrc >> 16) & 0xffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5941
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5942
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5943
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5944
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5945
// As loadConNKlass_hi this must be recognized as narrow klass, not oop!
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5946
instruct loadConNKlass_mask(iRegNdst dst, immNKlass_NM src1, iRegNsrc src2) %{
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5947
  match(Set dst src1);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5948
  effect(TEMP src2);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5949
  ins_cost(DEFAULT_COST);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5950
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5951
  format %{ "MASK    $dst, $src2, 0xFFFFFFFF" %} // mask
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5952
  size(4);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5953
  ins_encode %{
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5954
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5955
    __ clrldi($dst$$Register, $src2$$Register, 0x20);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5956
  %}
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5957
  ins_pipe(pipe_class_default);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5958
%}
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5959
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  5960
// 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
  5961
// not a narrow oop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5962
instruct loadConNKlass_lo(iRegNdst dst, immNKlass_NM src1, iRegNsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5963
  match(Set dst src1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5964
  effect(TEMP src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5965
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5966
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5967
  format %{ "ORI     $dst, $src1, $src2 \t// narrow klass lo" %}
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5968
  size(4);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5969
  ins_encode %{
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  5970
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5971
    intptr_t Csrc = Klass::encode_klass((Klass *)$src1$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5972
    assert(__ oop_recorder() != NULL, "this assembler needs an OopRecorder");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5973
    int klass_index = __ oop_recorder()->find_index((Klass *)$src1$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5974
    RelocationHolder rspec = metadata_Relocation::spec(klass_index);
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
    __ relocate(rspec, 1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5977
    __ ori($dst$$Register, $src2$$Register, Csrc & 0xffff);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5978
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5979
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5982
// Loading ConNKlass must be postalloc expanded so that edges between
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5983
// the nodes are safe. They may not interfere with a safepoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5984
instruct loadConNKlass_Ex(iRegNdst dst, immNKlass src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5985
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5986
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5987
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5988
  format %{ "LoadN   $dst, $src \t// postalloc expanded" %} // mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5989
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5990
    // Load high bits into register. Sign extended.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  5991
    MachNode *m1 = new loadConNKlass_hiNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5992
    m1->add_req(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5993
    m1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5994
    m1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5995
    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
  5996
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5997
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5998
    MachNode *m2 = m1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5999
    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
  6000
      // Value might be 1-extended. Mask out these bits.
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6001
      m2 = new loadConNKlass_maskNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6002
      m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6003
      m2->_opnds[0] = op_dst;
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6004
      m2->_opnds[1] = op_src;
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6005
      m2->_opnds[2] = op_dst;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6006
      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
  6007
      nodes->push(m2);
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
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6010
    MachNode *m3 = new loadConNKlass_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6011
    m3->add_req(NULL, m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6012
    m3->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6013
    m3->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6014
    m3->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6015
    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
  6016
    nodes->push(m3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6017
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6018
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6019
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6020
// 0x1 is used in object initialization (initial object header).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6021
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6022
instruct loadConP0or1(iRegPdst dst, immP_0or1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6023
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6024
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6025
  format %{ "LI      $dst, $src \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6026
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6027
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6028
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6029
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6030
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6031
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6032
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6033
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6034
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6035
// The match rule is needed to generate the correct bottom_type(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6036
// however this node should never match. The use of predicate is not
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6037
// possible since ADLC forbids predicates for chain rules. The higher
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6038
// costs do not prevent matching in this case. For that reason the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6039
// operand immP_NM with predicate(false) is used.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6040
instruct loadConP(iRegPdst dst, immP_NM src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6041
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6042
  effect(TEMP toc);
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
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6045
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6046
  format %{ "LD      $dst, offset, $toc \t// load ptr $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6047
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6048
  ins_encode( enc_load_long_constP(dst, src, toc) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6049
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6052
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6053
instruct loadConP_hi(iRegPdst dst, immP_NM src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6054
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6055
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6056
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6057
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6058
  ins_field_const_toc_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6059
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6060
  format %{ "ADDIS   $dst, $toc, offset \t// load ptr $src from TOC (hi)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6061
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6062
  ins_encode( enc_load_long_constP_hi(dst, src, toc) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6063
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6064
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6065
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6066
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6067
instruct loadConP_lo(iRegPdst dst, immP_NM src, iRegLdst base) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6068
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6069
  effect(TEMP base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6070
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6071
  ins_field_const_toc_offset_hi_node(loadConP_hiNode*);
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
  format %{ "LD      $dst, offset, $base \t// load ptr $src from TOC (lo)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6074
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6075
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6076
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  6077
    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
  6078
    __ ld($dst$$Register, MacroAssembler::largeoffset_si16_si16_lo(offset), $base$$Register);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6079
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6080
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6081
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6082
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6083
// Load pointer constant from constant table. Expand in case an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6084
// offset > 16 bit is needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6085
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6086
instruct loadConP_Ex(iRegPdst dst, immP src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6087
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6088
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6089
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6090
  // This rule does not use "expand" because then
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6091
  // the result type is not known to be an Oop.  An ADLC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6092
  // enhancement will be needed to make that work - not worth it!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6093
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6094
  // If this instruction rematerializes, it prolongs the live range
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6095
  // of the toc node, causing illegal graphs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6096
  // 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
  6097
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6098
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6099
  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
  6100
  postalloc_expand( postalloc_expand_load_ptr_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6101
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6102
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6103
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6104
instruct loadConF(regF dst, immF src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6105
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6106
  ins_cost(MEMORY_REF_COST);
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_num_consts(1);
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
  format %{ "LFS     $dst, offset, $toc \t// load float $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6111
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6112
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6113
    // TODO: PPC port $archOpcode(ppc64Opcode_lfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6114
    address float_address = __ float_constant($src$$constant);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6115
    if (float_address == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6116
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6117
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6118
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6119
    __ lfs($dst$$FloatRegister, __ offset_to_method_toc(float_address), $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6120
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6121
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6122
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6123
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6124
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6125
instruct loadConFComp(regF dst, immF src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6126
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6127
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6128
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6129
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6130
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6131
  format %{ "ADDIS   $toc, $toc, offset_hi\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6132
            "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
  6133
            "ADDIS   $toc, $toc, -offset_hi"%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6134
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6135
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6136
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6137
    FloatRegister Rdst    = $dst$$FloatRegister;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6138
    Register Rtoc         = $toc$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6139
    address float_address = __ float_constant($src$$constant);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6140
    if (float_address == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6141
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6142
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6143
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6144
    int offset            = __ offset_to_method_toc(float_address);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6145
    int hi = (offset + (1<<15))>>16;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6146
    int lo = offset - hi * (1<<16);
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
    __ addis(Rtoc, Rtoc, hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6149
    __ lfs(Rdst, lo, Rtoc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6150
    __ addis(Rtoc, Rtoc, -hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6151
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6152
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6153
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6154
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6155
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6156
instruct loadConF_Ex(regF dst, immF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6157
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6158
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6159
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6160
  // See loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6161
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6162
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6163
  format %{ "LFS     $dst, offset, $constanttablebase \t// load $src from table, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6164
  postalloc_expand( postalloc_expand_load_float_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6165
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6166
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6167
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6168
instruct loadConD(regD dst, immD src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6169
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6170
  ins_cost(MEMORY_REF_COST);
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 %{ "LFD     $dst, offset, $toc \t// load double $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 %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6177
    // TODO: PPC port $archOpcode(ppc64Opcode_lfd);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6178
    address float_address = __ double_constant($src$$constant);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6179
    if (float_address == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6180
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6181
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6182
    }
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6183
    int offset =  __ offset_to_method_toc(float_address);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6184
    __ lfd($dst$$FloatRegister, offset, $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6185
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6186
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6189
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6190
instruct loadConDComp(regD dst, immD src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6191
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6192
  ins_cost(MEMORY_REF_COST);
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
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6195
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6196
  format %{ "ADDIS   $toc, $toc, offset_hi\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6197
            "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
  6198
            "ADDIS   $toc, $toc, -offset_hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6199
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6200
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6201
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6202
    FloatRegister Rdst    = $dst$$FloatRegister;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6203
    Register      Rtoc    = $toc$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6204
    address float_address = __ double_constant($src$$constant);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6205
    if (float_address == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6206
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6207
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6208
    }
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6209
    int offset = __ offset_to_method_toc(float_address);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6210
    int hi = (offset + (1<<15))>>16;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6211
    int lo = offset - hi * (1<<16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6212
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6213
    __ addis(Rtoc, Rtoc, hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6214
    __ lfd(Rdst, lo, Rtoc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6215
    __ addis(Rtoc, Rtoc, -hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6216
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6217
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6218
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6219
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6220
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6221
instruct loadConD_Ex(regD dst, immD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6222
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6223
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6224
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6225
  // See loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6226
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6227
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6228
  format %{ "ConD    $dst, offset, $constanttablebase \t// load $src from table, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6229
  postalloc_expand( postalloc_expand_load_double_constant(dst, src, constanttablebase) );
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6232
// Prefetch instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6233
// Must be safe to execute with invalid address (cannot fault).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6234
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6235
// Special prefetch versions which use the dcbz instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6236
instruct prefetch_alloc_zero(indirectMemory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6237
  match(PrefetchAllocation (AddP mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6238
  predicate(AllocatePrefetchStyle == 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6239
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6240
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6241
  format %{ "PREFETCH $mem, 2, $src \t// Prefetch write-many with zero" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6242
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6243
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6244
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6245
    __ dcbz($src$$Register, $mem$$base$$Register);
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
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6248
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6249
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6250
instruct prefetch_alloc_zero_no_offset(indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6251
  match(PrefetchAllocation mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6252
  predicate(AllocatePrefetchStyle == 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6253
  ins_cost(MEMORY_REF_COST);
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 %{ "PREFETCH $mem, 2 \t// Prefetch write-many with zero" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6256
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6257
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6258
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6259
    __ dcbz($mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6260
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6261
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6262
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6263
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6264
instruct prefetch_alloc(indirectMemory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6265
  match(PrefetchAllocation (AddP mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6266
  predicate(AllocatePrefetchStyle != 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6267
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6268
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6269
  format %{ "PREFETCH $mem, 2, $src \t// Prefetch write-many" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6270
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6271
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6272
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6273
    __ dcbtst($src$$Register, $mem$$base$$Register);
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
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6276
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6277
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6278
instruct prefetch_alloc_no_offset(indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6279
  match(PrefetchAllocation mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6280
  predicate(AllocatePrefetchStyle != 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6281
  ins_cost(MEMORY_REF_COST);
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 %{ "PREFETCH $mem, 2 \t// Prefetch write-many" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6284
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6285
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6286
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6287
    __ dcbtst($mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6288
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6289
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6290
%}
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
//----------Store Instructions-------------------------------------------------
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
// Store Byte
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6295
instruct storeB(memory mem, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6296
  match(Set mem (StoreB mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6297
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6298
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6299
  format %{ "STB     $src, $mem \t// byte" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6300
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6301
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6302
    // TODO: PPC port $archOpcode(ppc64Opcode_stb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6303
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6304
    __ stb($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6305
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6306
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6307
%}
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
// Store Char/Short
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6310
instruct storeC(memory mem, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6311
  match(Set mem (StoreC mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6312
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6313
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6314
  format %{ "STH     $src, $mem \t// short" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6315
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6316
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6317
    // TODO: PPC port $archOpcode(ppc64Opcode_sth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6318
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6319
    __ sth($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6320
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6321
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6322
%}
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
// Store Integer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6325
instruct storeI(memory mem, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6326
  match(Set mem (StoreI mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6327
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6328
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6329
  format %{ "STW     $src, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6330
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6331
  ins_encode( enc_stw(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6332
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6333
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6334
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6335
// ConvL2I + StoreI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6336
instruct storeI_convL2I(memory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6337
  match(Set mem (StoreI mem (ConvL2I src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6338
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6339
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6340
  format %{ "STW     l2i($src), $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6341
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6342
  ins_encode( enc_stw(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6343
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6344
%}
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
// Store Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6347
instruct storeL(memoryAlg4 mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6348
  match(Set mem (StoreL mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6349
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6350
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6351
  format %{ "STD     $src, $mem \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6352
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6353
  ins_encode( enc_std(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6354
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6357
// Store super word nodes.
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
// Store Aligned Packed Byte long register to memory
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6360
instruct storeA8B(memoryAlg4 mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6361
  predicate(n->as_StoreVector()->memory_size() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6362
  match(Set mem (StoreVector mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6363
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6364
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6365
  format %{ "STD     $mem, $src \t// packed8B" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6366
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6367
  ins_encode( enc_std(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6368
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6369
%}
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
// Store Compressed Oop
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6372
instruct storeN(memory dst, iRegN_P2N src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6373
  match(Set dst (StoreN dst 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 %{ "STW     $src, $dst \t// compressed oop" %}
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( enc_stw(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6379
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6380
%}
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
// Store Compressed KLass
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6383
instruct storeNKlass(memory dst, iRegN_P2N src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6384
  match(Set dst (StoreNKlass dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6385
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6386
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6387
  format %{ "STW     $src, $dst \t// compressed klass" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6388
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6389
  ins_encode( enc_stw(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6390
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6391
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6392
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6393
// Store Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6394
instruct storeP(memoryAlg4 dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6395
  match(Set dst (StoreP dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6396
  ins_cost(MEMORY_REF_COST);
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
  format %{ "STD     $src, $dst \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6399
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6400
  ins_encode( enc_std(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6401
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6402
%}
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
// Store Float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6405
instruct storeF(memory mem, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6406
  match(Set mem (StoreF mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6407
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6408
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6409
  format %{ "STFS    $src, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6410
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6411
  ins_encode( enc_stfs(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6412
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6413
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6414
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6415
// Store Double
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6416
instruct storeD(memory mem, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6417
  match(Set mem (StoreD mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6418
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6419
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6420
  format %{ "STFD    $src, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6421
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6422
  ins_encode( enc_stfd(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6423
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6424
%}
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
//----------Store Instructions With Zeros--------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6427
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6428
// Card-mark for CMS garbage collection.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6429
// This cardmark does an optimization so that it must not always
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6430
// do a releasing store. For this, it gets the address of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6431
// CMSCollectorCardTableModRefBSExt::_requires_release as input.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6432
// (Using releaseFieldAddr in the match rule is a hack.)
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6433
instruct storeCM_CMS(memory mem, iRegLdst releaseFieldAddr, flagsReg crx) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6434
  match(Set mem (StoreCM mem releaseFieldAddr));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6435
  effect(TEMP crx);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6436
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6437
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6438
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6439
  // See loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6440
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6441
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6442
  format %{ "STB     #0, $mem \t// CMS card-mark byte (must be 0!), checking requires_release in [$releaseFieldAddr]" %}
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6443
  ins_encode( enc_cms_card_mark(mem, releaseFieldAddr, crx) );
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6444
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6447
// Card-mark for CMS garbage collection.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6448
// This cardmark does an optimization so that it must not always
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6449
// do a releasing store. For this, it needs the constant address of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6450
// CMSCollectorCardTableModRefBSExt::_requires_release.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6451
// 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
  6452
// adlc / matcher functionality to load it from the constant section.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6453
instruct storeCM_CMS_ExEx(memory mem, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6454
  match(Set mem (StoreCM mem zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6455
  predicate(UseConcMarkSweepGC);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6458
    immL baseImm %{ 0 /* TODO: PPC port (jlong)CMSCollectorCardTableModRefBSExt::requires_release_address() */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6459
    iRegLdst releaseFieldAddress;
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6460
    flagsReg crx;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6461
    loadConL_Ex(releaseFieldAddress, baseImm);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6462
    storeCM_CMS(mem, releaseFieldAddress, crx);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6463
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6464
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6465
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6466
instruct storeCM_G1(memory mem, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6467
  match(Set mem (StoreCM mem zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6468
  predicate(UseG1GC);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6469
  ins_cost(MEMORY_REF_COST);
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
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6472
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6473
  format %{ "STB     #0, $mem \t// CMS card-mark byte store (G1)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6474
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6475
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6476
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6477
    __ li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6478
    //__ release(); // G1: oops are allowed to get visible after dirty marking
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6479
    guarantee($mem$$base$$Register != R1_SP, "use frame_slots_bias");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6480
    __ stb(R0, $mem$$disp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6481
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6482
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6485
// Convert oop pointer into compressed form.
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
// Nodes for postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6488
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6489
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6490
instruct encodeP_shift(iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6491
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6492
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6493
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6494
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6495
  format %{ "SRDI    $dst, $src, 3 \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6496
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6497
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6498
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6499
    __ srdi($dst$$Register, $src$$Register, Universe::narrow_oop_shift() & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6500
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6501
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6504
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6505
instruct encodeP_sub(iRegPdst dst, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6506
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6507
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6508
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6509
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6510
  format %{ "SUB     $dst, $src, oop_base \t// encode" %}
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6511
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6512
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6513
    __ sub_const_optimized($dst$$Register, $src$$Register, Universe::narrow_oop_base(), R0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6514
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6515
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6516
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6517
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6518
// Conditional sub base.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6519
instruct cond_sub_base(iRegNdst dst, flagsRegSrc crx, iRegPsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6520
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6521
  match(Set dst (EncodeP (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6522
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6523
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6524
  format %{ "BEQ     $crx, done\n\t"
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6525
            "SUB     $dst, $src1, heapbase \t// encode: subtract base if != NULL\n"
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6526
            "done:" %}
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6527
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6528
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6529
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6530
    __ beq($crx$$CondRegister, done);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6531
    __ sub_const_optimized($dst$$Register, $src1$$Register, Universe::narrow_oop_base(), R0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6532
    __ bind(done);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6535
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6536
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6537
// Power 7 can use isel instruction
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6538
instruct cond_set_0_oop(iRegNdst dst, flagsRegSrc crx, iRegPsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6539
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6540
  match(Set dst (EncodeP (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6541
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6542
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6543
  format %{ "CMOVE   $dst, $crx eq, 0, $src1 \t// encode: preserve 0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6544
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6545
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6546
    // 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
  6547
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6548
    __ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6551
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6552
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6553
// Disjoint narrow oop base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6554
instruct encodeP_Disjoint(iRegNdst dst, iRegPsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6555
  match(Set dst (EncodeP src));
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6556
  predicate(Universe::narrow_oop_base_disjoint());
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6557
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6558
  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with disjoint base" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6559
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6560
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6561
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6562
    __ rldicl($dst$$Register, $src$$Register, 64-Universe::narrow_oop_shift(), 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6563
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6564
  ins_pipe(pipe_class_default);
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
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6568
instruct encodeP_Ex(iRegNdst dst, flagsReg crx, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6569
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6570
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6571
  predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6572
            Universe::narrow_oop_shift() != 0 &&
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6573
            Universe::narrow_oop_base_overlaps());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6574
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6575
  format %{ "EncodeP $dst, $crx, $src \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6576
  postalloc_expand( postalloc_expand_encode_oop(dst, src, crx));
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6579
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6580
instruct encodeP_not_null_Ex(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6581
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6582
  predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6583
            Universe::narrow_oop_shift() != 0 &&
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6584
            Universe::narrow_oop_base_overlaps());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6585
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6586
  format %{ "EncodeP $dst, $src\t// $src != Null, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6587
  postalloc_expand( postalloc_expand_encode_oop_not_null(dst, src) );
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6590
// shift != 0, base == 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6591
// TODO: This is the same as encodeP_shift. Merge!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6592
instruct encodeP_not_null_base_null(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6593
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6594
  predicate(Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6595
            Universe::narrow_oop_base() ==0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6596
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6597
  format %{ "SRDI    $dst, $src, #3 \t// encodeP, $src != NULL" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6598
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6599
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6600
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6601
    __ srdi($dst$$Register, $src$$Register, Universe::narrow_oop_shift() & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6602
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6603
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6604
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6605
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6606
// Compressed OOPs with narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6607
// shift == 0, base == 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6608
instruct encodeP_narrow_oop_shift_0(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6609
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6610
  predicate(Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6611
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6612
  format %{ "MR      $dst, $src \t// Ptr->Narrow" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6613
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6614
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6615
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6616
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6617
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6618
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6619
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6620
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6621
// Decode nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6622
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6623
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6624
instruct decodeN_shift(iRegPdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6625
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6626
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6627
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6628
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6629
  format %{ "SLDI    $dst, $src, #3 \t// DecodeN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6630
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6631
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6632
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6633
    __ sldi($dst$$Register, $src$$Register, Universe::narrow_oop_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6634
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6635
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6636
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6637
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6638
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6639
instruct decodeN_add(iRegPdst dst, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6640
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6641
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6642
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6643
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6644
  format %{ "ADD     $dst, $src, heapbase \t// DecodeN, add oop base" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6645
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6646
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6647
    __ add_const_optimized($dst$$Register, $src$$Register, Universe::narrow_oop_base(), R0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6648
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6649
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6650
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6651
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6652
// conditianal add base for expand
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6653
instruct cond_add_base(iRegPdst dst, flagsRegSrc crx, iRegPsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6654
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6655
  // 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
  6656
  //  - _matrule->_rChild->_opType == "DecodeN" (see InstructForm::captures_bottom_type() in formssel.cpp)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6657
  //  - we have to match 'crx' to avoid an "illegal USE of non-input: flagsReg crx" error in ADLC.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6658
  match(Set dst (DecodeN (Binary crx src)));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6659
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6660
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6661
  format %{ "BEQ     $crx, done\n\t"
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6662
            "ADD     $dst, $src, heapbase \t// DecodeN: add oop base if $src != NULL\n"
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6663
            "done:" %}
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6664
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6665
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6666
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6667
    __ beq($crx$$CondRegister, done);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6668
    __ add_const_optimized($dst$$Register, $src$$Register, Universe::narrow_oop_base(), R0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6669
    __ bind(done);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6672
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6673
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6674
instruct cond_set_0_ptr(iRegPdst dst, flagsRegSrc crx, iRegPsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6675
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6676
  // 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
  6677
  //  - _matrule->_rChild->_opType == "DecodeN" (see InstructForm::captures_bottom_type() in formssel.cpp)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6678
  //  - 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
  6679
  match(Set dst (DecodeN (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6680
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6681
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6682
  format %{ "CMOVE   $dst, $crx eq, 0, $src1 \t// decode: preserve 0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6683
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6684
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6685
    // 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
  6686
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6687
    __ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6688
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6689
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6690
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6691
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6692
//  shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6693
instruct decodeN_Ex(iRegPdst dst, iRegNsrc src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6694
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6695
  predicate((n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6696
             n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6697
            Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6698
            Universe::narrow_oop_base() != 0);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6699
  ins_cost(4 * DEFAULT_COST); // Should be more expensive than decodeN_Disjoint_isel_Ex.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6700
  effect(TEMP crx);
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
  format %{ "DecodeN $dst, $src \t// Kills $crx, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6703
  postalloc_expand( postalloc_expand_decode_oop(dst, src, crx) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6704
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6705
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6706
// shift != 0, base == 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6707
instruct decodeN_nullBase(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6708
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6709
  predicate(Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6710
            Universe::narrow_oop_base() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6711
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6712
  format %{ "SLDI    $dst, $src, #3 \t// DecodeN (zerobased)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6713
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6714
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6715
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6716
    __ sldi($dst$$Register, $src$$Register, Universe::narrow_oop_shift());
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6719
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6720
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6721
// Optimize DecodeN for disjoint base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6722
// Shift narrow oop and or it into register that already contains the heap base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6723
// Base == dst must hold, and is assured by construction in postaloc_expand.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6724
instruct decodeN_mergeDisjoint(iRegPdst dst, iRegNsrc src, iRegLsrc base) %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6725
  match(Set dst (DecodeN src));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6726
  effect(TEMP base);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6727
  predicate(false);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6728
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6729
  format %{ "RLDIMI  $dst, $src, shift, 32-shift \t// DecodeN (disjoint base)" %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6730
  size(4);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6731
  ins_encode %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6732
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6733
    __ rldimi($dst$$Register, $src$$Register, Universe::narrow_oop_shift(), 32-Universe::narrow_oop_shift());
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6734
  %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6735
  ins_pipe(pipe_class_default);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6736
%}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6737
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6738
// Optimize DecodeN for disjoint base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6739
// This node requires only one cycle on the critical path.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6740
// We must postalloc_expand as we can not express use_def effects where
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6741
// the used register is L and the def'ed register P.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6742
instruct decodeN_Disjoint_notNull_Ex(iRegPdst dst, iRegNsrc src) %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6743
  match(Set dst (DecodeN src));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6744
  effect(TEMP_DEF dst);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6745
  predicate((n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6746
             n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant) &&
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6747
            Universe::narrow_oop_base_disjoint());
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6748
  ins_cost(DEFAULT_COST);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6749
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6750
  format %{ "MOV     $dst, heapbase \t\n"
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6751
            "RLDIMI  $dst, $src, shift, 32-shift \t// decode with disjoint base" %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6752
  postalloc_expand %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6753
    loadBaseNode *n1 = new loadBaseNode();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6754
    n1->add_req(NULL);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6755
    n1->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6756
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6757
    decodeN_mergeDisjointNode *n2 = new decodeN_mergeDisjointNode();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6758
    n2->add_req(n_region, n_src, n1);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6759
    n2->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6760
    n2->_opnds[1] = op_src;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6761
    n2->_opnds[2] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6762
    n2->_bottom_type = _bottom_type;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6763
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6764
    ra_->set_pair(n1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6765
    ra_->set_pair(n2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6766
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6767
    nodes->push(n1);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6768
    nodes->push(n2);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6769
  %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6770
%}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6771
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6772
instruct decodeN_Disjoint_isel_Ex(iRegPdst dst, iRegNsrc src, flagsReg crx) %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6773
  match(Set dst (DecodeN src));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6774
  effect(TEMP_DEF dst, TEMP crx);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6775
  predicate((n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull &&
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6776
             n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant) &&
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6777
            Universe::narrow_oop_base_disjoint() && VM_Version::has_isel());
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6778
  ins_cost(3 * DEFAULT_COST);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6779
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6780
  format %{ "DecodeN  $dst, $src \t// decode with disjoint base using isel" %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6781
  postalloc_expand %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6782
    loadBaseNode *n1 = new loadBaseNode();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6783
    n1->add_req(NULL);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6784
    n1->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6785
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6786
    cmpN_reg_imm0Node *n_compare  = new cmpN_reg_imm0Node();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6787
    n_compare->add_req(n_region, n_src);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6788
    n_compare->_opnds[0] = op_crx;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6789
    n_compare->_opnds[1] = op_src;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6790
    n_compare->_opnds[2] = new immN_0Oper(TypeNarrowOop::NULL_PTR);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  6791
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6792
    decodeN_mergeDisjointNode *n2 = new decodeN_mergeDisjointNode();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6793
    n2->add_req(n_region, n_src, n1);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6794
    n2->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6795
    n2->_opnds[1] = op_src;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6796
    n2->_opnds[2] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6797
    n2->_bottom_type = _bottom_type;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6798
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6799
    cond_set_0_ptrNode *n_cond_set = new cond_set_0_ptrNode();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6800
    n_cond_set->add_req(n_region, n_compare, n2);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6801
    n_cond_set->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6802
    n_cond_set->_opnds[1] = op_crx;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6803
    n_cond_set->_opnds[2] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6804
    n_cond_set->_bottom_type = _bottom_type;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6805
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6806
    assert(ra_->is_oop(this) == true, "A decodeN node must produce an oop!");
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6807
    ra_->set_oop(n_cond_set, true);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6808
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6809
    ra_->set_pair(n1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6810
    ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6811
    ra_->set_pair(n2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6812
    ra_->set_pair(n_cond_set->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6813
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6814
    nodes->push(n1);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6815
    nodes->push(n_compare);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6816
    nodes->push(n2);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6817
    nodes->push(n_cond_set);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6818
  %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6819
%}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6820
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6821
// src != 0, shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6822
instruct decodeN_notNull_addBase_Ex(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6823
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6824
  predicate((n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6825
             n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6826
            Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6827
            Universe::narrow_oop_base() != 0);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6828
  ins_cost(2 * DEFAULT_COST);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6829
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6830
  format %{ "DecodeN $dst, $src \t// $src != NULL, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6831
  postalloc_expand( postalloc_expand_decode_oop_not_null(dst, src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6832
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6833
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6834
// Compressed OOPs with narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6835
instruct decodeN_unscaled(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6836
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6837
  predicate(Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6838
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6839
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6840
  format %{ "MR      $dst, $src \t// DecodeN (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6841
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6842
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6843
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6844
    __ mr_if_needed($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6847
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6848
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6849
// Convert compressed oop into int for vectors alignment masking.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6850
instruct decodeN2I_unscaled(iRegIdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6851
  match(Set dst (ConvL2I (CastP2X (DecodeN src))));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6852
  predicate(Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6853
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6854
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6855
  format %{ "MR      $dst, $src \t// (int)DecodeN (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6856
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6857
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6858
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6859
    __ mr_if_needed($dst$$Register, $src$$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
// Convert klass pointer into compressed form.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6865
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6866
// Nodes for postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6867
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6868
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6869
instruct encodePKlass_shift(iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6870
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6871
  match(Set dst (EncodePKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6872
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6873
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6874
  format %{ "SRDI    $dst, $src, 3 \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6875
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6876
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6877
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6878
    __ srdi($dst$$Register, $src$$Register, Universe::narrow_klass_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6879
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6880
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6881
%}
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
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6884
instruct encodePKlass_sub_base(iRegPdst dst, iRegLsrc base, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6885
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6886
  match(Set dst (EncodePKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6887
  predicate(false);
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
  format %{ "SUB     $dst, $base, $src \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6890
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6891
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6892
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6893
    __ subf($dst$$Register, $base$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6894
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6895
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6896
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6897
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6898
// Disjoint narrow oop base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6899
instruct encodePKlass_Disjoint(iRegNdst dst, iRegPsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6900
  match(Set dst (EncodePKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6901
  predicate(false /* TODO: PPC port Universe::narrow_klass_base_disjoint()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6902
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6903
  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with disjoint base" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6904
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6905
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6906
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6907
    __ rldicl($dst$$Register, $src$$Register, 64-Universe::narrow_klass_shift(), 32);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6908
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6909
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6910
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6911
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6912
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6913
instruct encodePKlass_not_null_Ex(iRegNdst dst, iRegLsrc base, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6914
  match(Set dst (EncodePKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6915
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6916
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6917
  format %{ "EncodePKlass $dst, $src\t// $src != Null, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6918
  postalloc_expand %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6919
    encodePKlass_sub_baseNode *n1 = new encodePKlass_sub_baseNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6920
    n1->add_req(n_region, n_base, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6921
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6922
    n1->_opnds[1] = op_base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6923
    n1->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6924
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6925
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6926
    encodePKlass_shiftNode *n2 = new encodePKlass_shiftNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6927
    n2->add_req(n_region, n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6928
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6929
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6930
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6931
    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
  6932
    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
  6933
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6934
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6935
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6936
  %}
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6939
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6940
instruct encodePKlass_not_null_ExEx(iRegNdst dst, iRegPsrc src) %{
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(Universe::narrow_klass_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6943
  //          true /* TODO: PPC port Universe::narrow_klass_base_overlaps()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6944
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6945
  //format %{ "EncodePKlass $dst, $src\t// $src != Null, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6946
  ins_cost(DEFAULT_COST*2);  // Don't count constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6947
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6948
    immL baseImm %{ (jlong)(intptr_t)Universe::narrow_klass_base() %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6949
    iRegLdst base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6950
    loadConL_Ex(base, baseImm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6951
    encodePKlass_not_null_Ex(dst, base, src);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6954
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6955
// Decode nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6956
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6957
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6958
instruct decodeNKlass_shift(iRegPdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6959
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6960
  match(Set dst (DecodeNKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6961
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6962
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6963
  format %{ "SLDI    $dst, $src, #3 \t// DecodeNKlass" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6964
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6965
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6966
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6967
    __ sldi($dst$$Register, $src$$Register, Universe::narrow_klass_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6968
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6969
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6970
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6971
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6972
// Add node for expand.
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
instruct decodeNKlass_add_base(iRegPdst dst, iRegLsrc base, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6975
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6976
  match(Set dst (DecodeNKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6977
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6978
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6979
  format %{ "ADD     $dst, $base, $src \t// DecodeNKlass, add klass base" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6980
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6981
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6982
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6983
    __ add($dst$$Register, $base$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6984
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6985
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6986
%}
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
// src != 0, shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6989
instruct decodeNKlass_notNull_addBase_Ex(iRegPdst dst, iRegLsrc base, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6990
  match(Set dst (DecodeNKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6991
  //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
  6992
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6993
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6994
  format %{ "DecodeNKlass $dst =  $base + ($src << 3) \t// $src != NULL, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6995
  postalloc_expand %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6996
    decodeNKlass_add_baseNode *n1 = new decodeNKlass_add_baseNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6997
    n1->add_req(n_region, n_base, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6998
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6999
    n1->_opnds[1] = op_base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7000
    n1->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7001
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7002
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  7003
    decodeNKlass_shiftNode *n2 = new decodeNKlass_shiftNode();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7004
    n2->add_req(n_region, n1);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7005
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7006
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7007
    n2->_bottom_type = _bottom_type;
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
    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
  7010
    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
  7011
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7012
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7013
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7014
  %}
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7017
// src != 0, shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7018
instruct decodeNKlass_notNull_addBase_ExEx(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7019
  match(Set dst (DecodeNKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7020
  // predicate(Universe::narrow_klass_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7021
  //           Universe::narrow_klass_base() != 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7022
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7023
  //format %{ "DecodeNKlass $dst, $src \t// $src != NULL, expanded" %}
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
  ins_cost(DEFAULT_COST*2);  // Don't count constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7026
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7027
    // 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
  7028
    // But we have to load the base pre-shifted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7029
    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
  7030
    iRegLdst base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7031
    loadConL_Ex(base, baseImm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7032
    decodeNKlass_notNull_addBase_Ex(dst, base, src);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7035
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7036
//----------MemBar Instructions-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7037
// Memory barrier flavors
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7038
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7039
instruct membar_acquire() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7040
  match(LoadFence);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7041
  ins_cost(4*MEMORY_REF_COST);
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
  format %{ "MEMBAR-acquire" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7044
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7045
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7046
    // TODO: PPC port $archOpcode(ppc64Opcode_lwsync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7047
    __ acquire();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7048
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7049
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7050
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7051
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7052
instruct unnecessary_membar_acquire() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7053
  match(MemBarAcquire);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7054
  ins_cost(0);
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
  format %{ " -- \t// redundant MEMBAR-acquire - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7057
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7058
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7059
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7060
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7061
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7062
instruct membar_acquire_lock() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7063
  match(MemBarAcquireLock);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7064
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7065
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7066
  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
  7067
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7068
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7069
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7070
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7071
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7072
instruct membar_release() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7073
  match(MemBarRelease);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7074
  match(StoreFence);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7075
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7076
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7077
  format %{ "MEMBAR-release" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7078
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7079
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7080
    // TODO: PPC port $archOpcode(ppc64Opcode_lwsync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7081
    __ release();
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7084
%}
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
instruct membar_storestore() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7087
  match(MemBarStoreStore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7088
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7089
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7090
  format %{ "MEMBAR-store-store" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7091
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7092
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7093
    // TODO: PPC port $archOpcode(ppc64Opcode_lwsync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7094
    __ membar(Assembler::StoreStore);
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_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7097
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7098
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7099
instruct membar_release_lock() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7100
  match(MemBarReleaseLock);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7101
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7102
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7103
  format %{ " -- \t// redundant MEMBAR-release - empty (release in FastUnlock)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7104
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7105
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7106
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7107
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7108
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7109
instruct membar_volatile() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7110
  match(MemBarVolatile);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7111
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7112
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7113
  format %{ "MEMBAR-volatile" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7114
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7115
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7116
    // TODO: PPC port $archOpcode(ppc64Opcode_sync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7117
    __ fence();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7118
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7119
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7120
%}
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
// This optimization is wrong on PPC. The following pattern is not supported:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7123
//  MemBarVolatile
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7124
//   ^        ^
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7125
//   |        |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7126
//  CtrlProj MemProj
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7127
//   ^        ^
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7128
//   |        |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7129
//   |       Load
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7130
//   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7131
//  MemBarVolatile
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
//  The first MemBarVolatile could get optimized out! According to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7134
//  Vladimir, this pattern can not occur on Oracle platforms.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7135
//  However, it does occur on PPC64 (because of membars in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7136
//  inline_unsafe_load_store).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7137
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7138
// 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
  7139
// 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
  7140
// we did other fixes in that method.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7141
//instruct unnecessary_membar_volatile() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7142
//  match(MemBarVolatile);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7143
//  predicate(Matcher::post_store_load_barrier(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7144
//  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7145
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7146
//  format %{ " -- \t// redundant MEMBAR-volatile - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7147
//  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7148
//  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7149
//  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7150
//%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7151
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7152
instruct membar_CPUOrder() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7153
  match(MemBarCPUOrder);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7154
  ins_cost(0);
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
  format %{ " -- \t// MEMBAR-CPUOrder - empty: PPC64 processors are self-consistent." %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7157
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7158
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7159
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7162
//----------Conditional Move---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7163
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7164
// Cmove using isel.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7165
instruct cmovI_reg_isel(cmpOp cmp, flagsRegSrc crx, iRegIdst dst, iRegIsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7166
  match(Set dst (CMoveI (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7167
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7168
  ins_cost(DEFAULT_COST);
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
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7171
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7172
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7173
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7174
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7175
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7176
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7177
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7178
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7181
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7182
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7183
instruct cmovI_reg(cmpOp cmp, flagsRegSrc crx, iRegIdst dst, iRegIsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7184
  match(Set dst (CMoveI (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7185
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7186
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7187
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7188
  ins_variable_size_depending_on_alignment(true);
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
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7191
  // Worst case is branch + move + stop, no stop without scheduler
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7192
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7193
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7194
  ins_pipe(pipe_class_default);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7197
instruct cmovI_imm(cmpOp cmp, flagsRegSrc crx, iRegIdst dst, immI16 src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7198
  match(Set dst (CMoveI (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7199
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7200
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7201
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7202
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7203
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7204
  // Worst case is branch + move + stop, no stop without scheduler
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7205
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7206
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7207
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7210
// Cmove using isel.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7211
instruct cmovL_reg_isel(cmpOp cmp, flagsRegSrc crx, iRegLdst dst, iRegLsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7212
  match(Set dst (CMoveL (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7213
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7214
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7215
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7216
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7217
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7218
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7219
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7220
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7221
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7222
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7223
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7224
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7225
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7226
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7227
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7228
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7229
instruct cmovL_reg(cmpOp cmp, flagsRegSrc crx, iRegLdst dst, iRegLsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7230
  match(Set dst (CMoveL (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7231
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7232
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7233
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7234
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7235
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7236
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7237
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7238
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7239
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7240
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7241
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7242
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7243
instruct cmovL_imm(cmpOp cmp, flagsRegSrc crx, iRegLdst dst, immL16 src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7244
  match(Set dst (CMoveL (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7245
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7246
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7247
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7248
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7249
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7250
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7251
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7252
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7253
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7254
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7255
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7256
// Cmove using isel.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7257
instruct cmovN_reg_isel(cmpOp cmp, flagsRegSrc crx, iRegNdst dst, iRegNsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7258
  match(Set dst (CMoveN (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7259
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7260
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7261
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7262
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7263
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7264
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7265
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7266
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7267
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7268
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7269
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7270
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
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_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7275
// Conditional move for RegN. Only cmov(reg, reg).
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7276
instruct cmovN_reg(cmpOp cmp, flagsRegSrc crx, iRegNdst dst, iRegNsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7277
  match(Set dst (CMoveN (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7278
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7279
  ins_cost(DEFAULT_COST+BRANCH_COST);
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
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7282
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7283
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7284
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7285
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7286
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7287
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7288
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7289
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7290
instruct cmovN_imm(cmpOp cmp, flagsRegSrc crx, iRegNdst dst, immN_0 src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7291
  match(Set dst (CMoveN (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7292
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7293
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7294
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7295
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7296
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7297
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7298
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7299
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7300
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7301
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7302
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7303
// Cmove using isel.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7304
instruct cmovP_reg_isel(cmpOp cmp, flagsRegSrc crx, iRegPdst dst, iRegPsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7305
  match(Set dst (CMoveP (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7306
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7307
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7308
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7309
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7310
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7311
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7312
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7313
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7314
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7315
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7316
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7317
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7318
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7319
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7320
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7321
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7322
instruct cmovP_reg(cmpOp cmp, flagsRegSrc crx, iRegPdst dst, iRegP_N2P src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7323
  match(Set dst (CMoveP (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7324
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7325
  ins_cost(DEFAULT_COST+BRANCH_COST);
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
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7328
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7329
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7330
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7331
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7332
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7333
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7334
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7335
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7336
instruct cmovP_imm(cmpOp cmp, flagsRegSrc crx, iRegPdst dst, immP_0 src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7337
  match(Set dst (CMoveP (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7338
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7339
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7340
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7341
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7342
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7343
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7344
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7345
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7346
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7347
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7348
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7349
instruct cmovF_reg(cmpOp cmp, flagsRegSrc crx, regF dst, regF src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7350
  match(Set dst (CMoveF (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7351
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7352
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7353
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7354
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7355
  format %{ "CMOVEF  $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7356
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7357
  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
  7358
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7359
    // TODO: PPC port $archOpcode(ppc64Opcode_cmovef);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7360
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7361
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7362
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7363
    __ 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
  7364
    __ fmr($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7365
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7366
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7367
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7368
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7369
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7370
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7371
instruct cmovD_reg(cmpOp cmp, flagsRegSrc crx, regD dst, regD src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7372
  match(Set dst (CMoveD (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7373
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7374
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7375
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7376
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7377
  format %{ "CMOVEF  $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7378
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7379
  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
  7380
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7381
    // TODO: PPC port $archOpcode(ppc64Opcode_cmovef);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7382
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7383
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7384
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7385
    __ 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
  7386
    __ fmr($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7387
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7388
    __ bind(done);
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
//----------Conditional_store--------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7394
// Conditional-store of the updated heap-top.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7395
// Used during allocation of the shared heap.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7396
// Sets flags (EQ) on success. Implemented with a CASA on Sparc.
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
// As compareAndSwapL, but return flag register instead of boolean value in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7399
// int register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7400
// Used by sun/misc/AtomicLongCSImpl.java.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7401
// 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
  7402
// 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
  7403
// can be rematerialized which leads to errors.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7404
instruct storeLConditional_regP_regL_regL(flagsReg crx, indirect mem_ptr, iRegLsrc oldVal, iRegLsrc newVal, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7405
  match(Set crx (StoreLConditional mem_ptr (Binary oldVal newVal)));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7406
  effect(TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7407
  format %{ "CMPXCHGD if ($crx = ($oldVal == *$mem_ptr)) *mem_ptr = $newVal; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7408
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7409
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7410
    __ cmpxchgd($crx$$CondRegister, R0, $oldVal$$Register, $newVal$$Register, $mem_ptr$$Register,
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7411
                MacroAssembler::MemBarAcq, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7412
                noreg, NULL, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7413
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7414
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7415
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7416
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7417
// As compareAndSwapP, but return flag register instead of boolean value in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7418
// int register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7419
// This instruction is matched if UseTLAB is off.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7420
// 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
  7421
// 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
  7422
// can be rematerialized which leads to errors.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7423
instruct storePConditional_regP_regP_regP(flagsRegCR0 cr0, indirect mem_ptr, iRegPsrc oldVal, iRegPsrc newVal) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7424
  match(Set cr0 (StorePConditional mem_ptr (Binary oldVal newVal)));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7425
  ins_cost(2*MEMORY_REF_COST);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7426
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7427
  format %{ "STDCX_  if ($cr0 = ($oldVal == *$mem_ptr)) *mem_ptr = $newVal; as bool" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7428
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7429
    // TODO: PPC port $archOpcode(ppc64Opcode_stdcx_);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7430
    __ stdcx_($newVal$$Register, $mem_ptr$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7431
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7432
  ins_pipe(pipe_class_memory);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7433
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7434
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7435
// Implement LoadPLocked. Must be ordered against changes of the memory location
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7436
// by storePConditional.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7437
// Don't know whether this is ever used.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7438
instruct loadPLocked(iRegPdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7439
  match(Set dst (LoadPLocked mem));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7440
  ins_cost(2*MEMORY_REF_COST);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7441
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7442
  format %{ "LDARX   $dst, $mem \t// loadPLocked\n\t" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7443
  size(4);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7444
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7445
    // TODO: PPC port $archOpcode(ppc64Opcode_ldarx);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7446
    __ ldarx($dst$$Register, $mem$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7447
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7448
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7449
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7450
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7451
//----------Compare-And-Swap---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7452
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7453
// CompareAndSwap{P,I,L} have more than one output, therefore "CmpI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7454
// (CompareAndSwap ...)" or "If (CmpI (CompareAndSwap ..))"  cannot be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7455
// matched.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7456
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7457
// Strong versions:
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7458
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7459
instruct compareAndSwapB_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7460
  match(Set res (CompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7461
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7462
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7463
  format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7464
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7465
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7466
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7467
    __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7468
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7469
                $res$$Register, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7470
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7471
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7472
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7473
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7474
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7475
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7476
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7477
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7478
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7479
instruct compareAndSwapB4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7480
  match(Set res (CompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7481
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7482
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7483
  format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7484
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7485
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7486
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7487
    __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7488
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7489
                $res$$Register, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7490
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7491
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7492
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7493
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7494
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7495
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7496
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7497
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7498
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7499
instruct compareAndSwapS_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7500
  match(Set res (CompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7501
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7502
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7503
  format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7504
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7505
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7506
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7507
    __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7508
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7509
                $res$$Register, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7510
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7511
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7512
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7513
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7514
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7515
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7516
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7517
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7518
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7519
instruct compareAndSwapS4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7520
  match(Set res (CompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7521
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7522
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7523
  format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7524
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7525
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7526
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7527
    __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7528
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7529
                $res$$Register, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7530
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7531
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7532
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7533
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7534
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7535
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7536
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7537
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7538
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7539
instruct compareAndSwapI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7540
  match(Set res (CompareAndSwapI mem_ptr (Binary src1 src2)));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7541
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
22861
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
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7544
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7545
    // 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
  7546
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7547
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7548
                $res$$Register, true);
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7549
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7550
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7551
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7552
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7553
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7554
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7555
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7556
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7557
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7558
instruct compareAndSwapN_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr, iRegNsrc src1, iRegNsrc src2, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7559
  match(Set res (CompareAndSwapN mem_ptr (Binary src1 src2)));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7560
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7561
  format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7562
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7563
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7564
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7565
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7566
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7567
                $res$$Register, true);
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7568
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7569
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7570
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7571
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7572
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7573
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7574
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7575
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7576
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7577
instruct compareAndSwapL_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7578
  match(Set res (CompareAndSwapL mem_ptr (Binary src1 src2)));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7579
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7580
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7581
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7582
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7583
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7584
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7585
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7586
                $res$$Register, NULL, true);
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7587
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7588
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7589
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7590
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7591
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7592
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7593
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7594
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7595
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7596
instruct compareAndSwapP_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr, iRegPsrc src1, iRegPsrc src2, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7597
  match(Set res (CompareAndSwapP mem_ptr (Binary src1 src2)));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7598
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7599
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7600
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7601
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7602
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7603
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7604
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7605
                $res$$Register, NULL, true);
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7606
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7607
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7608
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7609
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7610
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7611
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7612
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7613
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7614
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7615
// Weak versions:
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7616
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7617
instruct weakCompareAndSwapB_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7618
  match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7619
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7620
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7621
  format %{ "weak CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7622
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7623
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7624
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7625
    __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7626
                MacroAssembler::MemBarNone,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7627
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7628
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7629
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7630
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7631
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7632
instruct weakCompareAndSwapB4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7633
  match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7634
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && !VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7635
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7636
  format %{ "weak CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7637
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7638
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7639
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7640
    __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7641
                MacroAssembler::MemBarNone,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7642
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7643
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7644
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7645
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7646
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7647
instruct weakCompareAndSwapB_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7648
  match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7649
  predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7650
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7651
  format %{ "weak CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7652
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7653
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7654
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7655
    __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7656
                support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7657
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7658
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7659
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7660
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7661
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7662
instruct weakCompareAndSwapB4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7663
  match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7664
  predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && !VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7665
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7666
  format %{ "weak CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7667
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7668
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7669
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7670
    __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7671
                support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7672
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7673
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7674
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7675
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7676
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7677
instruct weakCompareAndSwapS_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7678
  match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7679
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7680
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7681
  format %{ "weak CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7682
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7683
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7684
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7685
    __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7686
                MacroAssembler::MemBarNone,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7687
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7688
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7689
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7690
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7691
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7692
instruct weakCompareAndSwapS4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7693
  match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7694
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && !VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7695
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7696
  format %{ "weak CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7697
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7698
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7699
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7700
    __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7701
                MacroAssembler::MemBarNone,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7702
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7703
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7704
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7705
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7706
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7707
instruct weakCompareAndSwapS_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7708
  match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7709
  predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7710
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7711
  format %{ "weak CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7712
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7713
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7714
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7715
    __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7716
                support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7717
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7718
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7719
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7720
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7721
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7722
instruct weakCompareAndSwapS4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7723
  match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7724
  predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && !VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7725
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7726
  format %{ "weak CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7727
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7728
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7729
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7730
    __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7731
                support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7732
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7733
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7734
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7735
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7736
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7737
instruct weakCompareAndSwapI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7738
  match(Set res (WeakCompareAndSwapI mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7739
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7740
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7741
  format %{ "weak CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7742
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7743
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7744
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7745
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7746
                MacroAssembler::MemBarNone,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7747
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7748
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7749
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7750
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7751
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7752
instruct weakCompareAndSwapI_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7753
  match(Set res (WeakCompareAndSwapI mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7754
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7755
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7756
  format %{ "weak CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7757
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7758
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7759
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7760
    // Acquire only needed in successful case. Weak node is allowed to report unsuccessful in additional rare cases and
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7761
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7762
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7763
                support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7764
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7765
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7766
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7767
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7768
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7769
instruct weakCompareAndSwapN_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr, iRegNsrc src1, iRegNsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7770
  match(Set res (WeakCompareAndSwapN mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7771
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7772
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7773
  format %{ "weak CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7774
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7775
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7776
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7777
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7778
                MacroAssembler::MemBarNone,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7779
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7780
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7781
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7782
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7783
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7784
instruct weakCompareAndSwapN_acq_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr, iRegNsrc src1, iRegNsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7785
  match(Set res (WeakCompareAndSwapN mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7786
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7787
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7788
  format %{ "weak CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7789
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7790
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7791
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7792
    // Acquire only needed in successful case. Weak node is allowed to report unsuccessful in additional rare cases and
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7793
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7794
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7795
                support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7796
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7797
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7798
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7799
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7800
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7801
instruct weakCompareAndSwapL_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7802
  match(Set res (WeakCompareAndSwapL mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7803
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7804
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7805
  format %{ "weak CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7806
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7807
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7808
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7809
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7810
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7811
                MacroAssembler::MemBarNone,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7812
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, NULL, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7813
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7814
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7815
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7816
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7817
instruct weakCompareAndSwapL_acq_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7818
  match(Set res (WeakCompareAndSwapL mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7819
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7820
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7821
  format %{ "weak CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7822
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7823
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7824
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7825
    // Acquire only needed in successful case. Weak node is allowed to report unsuccessful in additional rare cases and
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7826
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7827
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7828
                support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7829
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, NULL, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7830
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7831
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7832
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7833
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7834
instruct weakCompareAndSwapP_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr, iRegPsrc src1, iRegPsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7835
  match(Set res (WeakCompareAndSwapP mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7836
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7837
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7838
  format %{ "weak CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7839
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7840
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7841
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7842
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7843
                MacroAssembler::MemBarNone,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7844
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, NULL, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7845
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7846
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7847
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7848
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7849
instruct weakCompareAndSwapP_acq_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr, iRegPsrc src1, iRegPsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7850
  match(Set res (WeakCompareAndSwapP mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7851
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7852
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7853
  format %{ "weak CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7854
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7855
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7856
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7857
    // Acquire only needed in successful case. Weak node is allowed to report unsuccessful in additional rare cases and
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7858
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7859
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7860
                support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7861
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, NULL, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7862
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7863
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7864
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7865
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7866
// CompareAndExchange
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7867
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7868
instruct compareAndExchangeB_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7869
  match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7870
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7871
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7872
  format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7873
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7874
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7875
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7876
    __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7877
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7878
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7879
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7880
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7881
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7882
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7883
instruct compareAndExchangeB4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7884
  match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7885
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && !VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7886
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7887
  format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7888
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7889
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7890
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7891
    __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7892
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7893
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7894
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7895
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7896
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7897
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7898
instruct compareAndExchangeB_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7899
  match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7900
  predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7901
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7902
  format %{ "CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7903
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7904
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7905
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7906
    __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7907
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7908
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7909
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7910
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7911
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7912
      // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7913
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7914
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7915
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7916
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7917
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7918
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7919
instruct compareAndExchangeB4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7920
  match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7921
  predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && !VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7922
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7923
  format %{ "CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7924
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7925
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7926
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7927
    __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7928
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7929
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7930
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7931
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7932
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7933
      // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7934
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7935
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7936
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7937
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7938
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7939
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7940
instruct compareAndExchangeS_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7941
  match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7942
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7943
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7944
  format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7945
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7946
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7947
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7948
    __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7949
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7950
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7951
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7952
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7953
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7954
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7955
instruct compareAndExchangeS4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7956
  match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7957
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && !VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7958
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7959
  format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7960
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7961
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7962
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7963
    __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7964
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7965
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7966
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7967
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7968
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7969
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7970
instruct compareAndExchangeS_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7971
  match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7972
  predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7973
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7974
  format %{ "CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7975
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7976
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7977
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7978
    __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7979
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7980
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7981
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7982
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7983
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7984
      // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7985
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7986
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7987
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7988
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7989
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7990
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7991
instruct compareAndExchangeS4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7992
  match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7993
  predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && !VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7994
  effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7995
  format %{ "CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7996
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7997
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7998
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7999
    __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8000
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8001
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8002
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8003
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8004
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8005
      // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8006
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8007
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8008
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8009
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8010
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8011
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8012
instruct compareAndExchangeI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8013
  match(Set res (CompareAndExchangeI mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8014
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8015
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8016
  format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as int" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8017
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8018
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8019
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8020
    __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8021
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8022
                noreg, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8023
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8024
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8025
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8026
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8027
instruct compareAndExchangeI_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8028
  match(Set res (CompareAndExchangeI mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8029
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8030
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8031
  format %{ "CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as int" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8032
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8033
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8034
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8035
    __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8036
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8037
                noreg, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8038
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8039
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8040
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8041
      // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8042
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8043
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8044
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8045
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8046
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8047
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8048
instruct compareAndExchangeN_regP_regN_regN(iRegNdst res, iRegPdst mem_ptr, iRegNsrc src1, iRegNsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8049
  match(Set res (CompareAndExchangeN mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8050
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8051
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8052
  format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as narrow oop" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8053
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8054
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8055
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8056
    __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8057
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8058
                noreg, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8059
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8060
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8061
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8062
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8063
instruct compareAndExchangeN_acq_regP_regN_regN(iRegNdst res, iRegPdst mem_ptr, iRegNsrc src1, iRegNsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8064
  match(Set res (CompareAndExchangeN mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8065
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8066
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8067
  format %{ "CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as narrow oop" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8068
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8069
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8070
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8071
    __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8072
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8073
                noreg, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8074
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8075
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8076
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8077
      // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8078
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8079
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8080
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8081
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8082
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8083
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8084
instruct compareAndExchangeL_regP_regL_regL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8085
  match(Set res (CompareAndExchangeL mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8086
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8087
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8088
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as long" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8089
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8090
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8091
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8092
    __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8093
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8094
                noreg, NULL, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8095
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8096
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8097
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8098
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8099
instruct compareAndExchangeL_acq_regP_regL_regL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8100
  match(Set res (CompareAndExchangeL mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8101
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8102
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8103
  format %{ "CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as long" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8104
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8105
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8106
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8107
    __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8108
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8109
                noreg, NULL, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8110
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8111
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8112
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8113
      // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8114
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8115
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8116
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8117
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8118
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8119
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8120
instruct compareAndExchangeP_regP_regP_regP(iRegPdst res, iRegPdst mem_ptr, iRegPsrc src1, iRegPsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8121
  match(Set res (CompareAndExchangeP mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8122
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8123
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8124
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as ptr; ptr" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8125
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8126
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8127
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8128
    __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8129
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8130
                noreg, NULL, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8131
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8132
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8133
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8134
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8135
instruct compareAndExchangeP_acq_regP_regP_regP(iRegPdst res, iRegPdst mem_ptr, iRegPsrc src1, iRegPsrc src2, flagsRegCR0 cr0) %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8136
  match(Set res (CompareAndExchangeP mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8137
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8138
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8139
  format %{ "CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as ptr; ptr" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8140
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8141
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8142
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8143
    __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8144
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8145
                noreg, NULL, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8146
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8147
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8148
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8149
      // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8150
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8151
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8152
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8153
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8154
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8155
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8156
// Special RMW
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8157
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8158
instruct getAndAddB(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8159
  match(Set res (GetAndAddB mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8160
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8161
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8162
  format %{ "GetAndAddB $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8163
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8164
    __ getandaddb($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8165
                  R0, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8166
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8167
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8168
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8169
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8170
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8171
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8172
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8173
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8174
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8175
instruct getAndAddB4(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src, iRegIsrc tmp1, iRegIsrc tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8176
  match(Set res (GetAndAddB mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8177
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8178
  effect(TEMP_DEF res, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8179
  format %{ "GetAndAddB $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8180
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8181
    __ getandaddb($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8182
                  R0, $tmp1$$Register, $tmp2$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8183
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8184
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8185
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8186
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8187
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8188
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8189
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8190
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8191
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8192
instruct getAndAddS(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8193
  match(Set res (GetAndAddS mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8194
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8195
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8196
  format %{ "GetAndAddS $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8197
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8198
    __ getandaddh($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8199
                  R0, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8200
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8201
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8202
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8203
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8204
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8205
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8206
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8207
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8208
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8209
instruct getAndAddS4(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src, iRegIsrc tmp1, iRegIsrc tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8210
  match(Set res (GetAndAddS mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8211
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8212
  effect(TEMP_DEF res, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8213
  format %{ "GetAndAddS $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8214
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8215
    __ getandaddh($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8216
                  R0, $tmp1$$Register, $tmp2$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8217
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8218
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8219
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8220
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8221
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8222
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8223
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8224
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8225
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8226
instruct getAndAddI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8227
  match(Set res (GetAndAddI mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8228
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8229
  format %{ "GetAndAddI $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8230
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8231
    __ getandaddw($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8232
                  R0, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8233
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8234
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8235
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8236
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8237
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8238
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8239
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8240
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8241
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8242
instruct getAndAddL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8243
  match(Set res (GetAndAddL mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8244
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8245
  format %{ "GetAndAddL $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8246
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8247
    __ getandaddd($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8248
                  R0, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8249
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8250
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8251
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8252
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8253
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8254
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8255
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8256
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8257
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8258
instruct getAndSetB(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8259
  match(Set res (GetAndSetB mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8260
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8261
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8262
  format %{ "GetAndSetB $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8263
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8264
    __ getandsetb($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8265
                  noreg, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8266
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8267
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8268
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8269
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8270
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8271
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8272
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8273
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8274
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8275
instruct getAndSetB4(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src, iRegIsrc tmp1, iRegIsrc tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8276
  match(Set res (GetAndSetB mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8277
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8278
  effect(TEMP_DEF res, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8279
  format %{ "GetAndSetB $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8280
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8281
    __ getandsetb($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8282
                  R0, $tmp1$$Register, $tmp2$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8283
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8284
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8285
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8286
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8287
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8288
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8289
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8290
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8291
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8292
instruct getAndSetS(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8293
  match(Set res (GetAndSetS mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8294
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8295
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8296
  format %{ "GetAndSetS $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8297
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8298
    __ getandseth($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8299
                  noreg, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8300
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8301
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8302
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8303
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8304
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8305
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8306
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8307
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8308
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8309
instruct getAndSetS4(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src, iRegIsrc tmp1, iRegIsrc tmp2, flagsRegCR0 cr0) %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8310
  match(Set res (GetAndSetS mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8311
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8312
  effect(TEMP_DEF res, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8313
  format %{ "GetAndSetS $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8314
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8315
    __ getandseth($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8316
                  R0, $tmp1$$Register, $tmp2$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8317
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8318
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8319
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8320
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8321
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8322
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8323
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8324
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8325
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8326
instruct getAndSetI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8327
  match(Set res (GetAndSetI mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8328
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8329
  format %{ "GetAndSetI $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8330
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8331
    __ getandsetw($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8332
                  MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8333
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8334
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8335
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8336
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8337
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8338
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8339
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8340
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8341
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8342
instruct getAndSetL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8343
  match(Set res (GetAndSetL mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8344
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8345
  format %{ "GetAndSetL $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8346
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8347
    __ getandsetd($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8348
                  MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8349
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8350
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8351
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8352
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8353
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8354
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8355
  ins_pipe(pipe_class_default);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8358
instruct getAndSetP(iRegPdst res, iRegPdst mem_ptr, iRegPsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8359
  match(Set res (GetAndSetP mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8360
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8361
  format %{ "GetAndSetP $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8362
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8363
    __ getandsetd($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8364
                  MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8365
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8366
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8367
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8368
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8369
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8370
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8371
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8372
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8373
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8374
instruct getAndSetN(iRegNdst res, iRegPdst mem_ptr, iRegNsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8375
  match(Set res (GetAndSetN mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8376
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8377
  format %{ "GetAndSetN $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8378
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8379
    __ getandsetw($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8380
                  MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8381
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8382
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8383
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8384
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8385
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8386
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8387
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8390
//----------Arithmetic Instructions--------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8391
// Addition Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8392
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8393
// Register Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8394
instruct addI_reg_reg(iRegIdst dst, iRegIsrc_iRegL2Isrc src1, iRegIsrc_iRegL2Isrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8395
  match(Set dst (AddI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8396
  format %{ "ADD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8397
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8398
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8399
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8400
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8401
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8402
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8403
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8404
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8405
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8406
instruct addI_reg_reg_2(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8407
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8408
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8409
  format %{ "ADD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8410
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8411
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8412
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8413
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8414
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8415
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8416
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8417
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8418
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
  8419
  match(Set dst (AddI (AddI (AddI src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8420
  ins_cost(DEFAULT_COST*3);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8423
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8424
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8425
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8426
    addI_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8427
    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
  8428
    addI_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8429
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8430
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8431
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8432
// Immediate Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8433
instruct addI_reg_imm16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8434
  match(Set dst (AddI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8435
  format %{ "ADDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8436
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8437
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8438
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8439
    __ addi($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8440
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8441
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8442
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8443
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8444
// Immediate Addition with 16-bit shifted operand
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8445
instruct addI_reg_immhi16(iRegIdst dst, iRegIsrc src1, immIhi16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8446
  match(Set dst (AddI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8447
  format %{ "ADDIS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8448
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8449
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8450
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8451
    __ addis($dst$$Register, $src1$$Register, ($src2$$constant)>>16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8452
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8453
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8454
%}
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
// Long Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8457
instruct addL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8458
  match(Set dst (AddL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8459
  format %{ "ADD     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8460
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8461
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8462
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8463
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8464
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8465
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8466
%}
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
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8469
instruct addL_reg_reg_2(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8470
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8471
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8472
  format %{ "ADD     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8473
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8474
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8475
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8476
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8477
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8478
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8479
%}
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
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
  8482
  match(Set dst (AddL (AddL (AddL src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8483
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8484
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8485
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8486
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8487
    iRegLdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8488
    iRegLdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8489
    addL_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8490
    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
  8491
    addL_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8492
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8493
%}
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
// AddL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8496
instruct addI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8497
  match(Set dst (ConvL2I (AddL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8498
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8499
  format %{ "ADD     $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8500
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8501
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8502
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8503
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8504
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8505
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8506
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8507
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8508
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8509
instruct addL_reg_imm16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8510
  match(Set dst (AddL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8511
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8512
  format %{ "ADDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8513
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8514
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8515
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8516
    __ addi($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8517
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8518
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8519
%}
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
// Long Immediate Addition with 16-bit shifted operand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8522
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8523
instruct addL_reg_immhi16(iRegLdst dst, iRegLsrc src1, immL32hi16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8524
  match(Set dst (AddL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8525
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8526
  format %{ "ADDIS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8527
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8528
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8529
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8530
    __ addis($dst$$Register, $src1$$Register, ($src2$$constant)>>16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8531
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8532
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8533
%}
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
// Pointer Register Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8536
instruct addP_reg_reg(iRegPdst dst, iRegP_N2P src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8537
  match(Set dst (AddP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8538
  format %{ "ADD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8539
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8540
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8541
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8542
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8545
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8546
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8547
// Pointer Immediate Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8548
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8549
instruct addP_reg_imm16(iRegPdst dst, iRegP_N2P src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8550
  match(Set dst (AddP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8551
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8552
  format %{ "ADDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8553
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8554
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8555
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8556
    __ addi($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8557
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8558
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8559
%}
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
// Pointer Immediate Addition with 16-bit shifted operand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8562
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8563
instruct addP_reg_immhi16(iRegPdst dst, iRegP_N2P src1, immL32hi16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8564
  match(Set dst (AddP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8565
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8566
  format %{ "ADDIS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8567
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8568
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8569
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8570
    __ addis($dst$$Register, $src1$$Register, ($src2$$constant)>>16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8571
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8572
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8575
//---------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8576
// Subtraction Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8577
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8578
// Register Subtraction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8579
instruct subI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8580
  match(Set dst (SubI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8581
  format %{ "SUBF    $dst, $src2, $src1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8582
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8583
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8584
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8585
    __ subf($dst$$Register, $src2$$Register, $src1$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8588
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8589
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8590
// Immediate Subtraction
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8591
// Immediate Subtraction: The compiler converts "x-c0" into "x+ -c0" (see SubLNode::Ideal),
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8592
// Don't try to use addi with - $src2$$constant since it can overflow when $src2$$constant == minI16.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8593
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8594
// SubI from constant (using subfic).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8595
instruct subI_imm16_reg(iRegIdst dst, immI16 src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8596
  match(Set dst (SubI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8597
  format %{ "SUBI    $dst, $src1, $src2" %}
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
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8600
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8601
    // TODO: PPC port $archOpcode(ppc64Opcode_subfic);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8602
    __ subfic($dst$$Register, $src2$$Register, $src1$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8603
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8604
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8605
%}
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
// 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
  8608
// positive integers and 0xF...F for negative ones.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8609
instruct signmask32I_regI(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8610
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8611
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8612
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8613
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8614
  format %{ "SRAWI   $dst, $src, #31" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8615
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8616
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8617
    // TODO: PPC port $archOpcode(ppc64Opcode_srawi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8618
    __ srawi($dst$$Register, $src$$Register, 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8619
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8620
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8621
%}
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
instruct absI_reg_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8624
  match(Set dst (AbsI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8625
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8626
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8627
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8628
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8629
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8630
    signmask32I_regI(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8631
    xorI_reg_reg(tmp2, tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8632
    subI_reg_reg(dst, tmp2, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8633
  %}
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8636
instruct negI_regI(iRegIdst dst, immI_0 zero, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8637
  match(Set dst (SubI zero src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8638
  format %{ "NEG     $dst, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8639
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8640
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8641
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8642
    __ neg($dst$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8645
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8646
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8647
// Long subtraction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8648
instruct subL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8649
  match(Set dst (SubL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8650
  format %{ "SUBF    $dst, $src2, $src1 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8651
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8652
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8653
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8654
    __ subf($dst$$Register, $src2$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8655
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8656
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8657
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8658
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8659
// SubL + convL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8660
instruct subI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8661
  match(Set dst (ConvL2I (SubL src1 src2)));
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
  format %{ "SUBF    $dst, $src2, $src1 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8664
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8665
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8666
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8667
    __ subf($dst$$Register, $src2$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8668
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8669
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8670
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8671
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8672
// 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
  8673
// positive longs and 0xF...F for negative ones.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8674
instruct signmask64I_regL(iRegIdst dst, iRegLsrc src) %{
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8675
  // no match-rule, false predicate
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8676
  effect(DEF dst, USE src);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8677
  predicate(false);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8678
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8679
  format %{ "SRADI   $dst, $src, #63" %}
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8680
  size(4);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8681
  ins_encode %{
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8682
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8683
    __ sradi($dst$$Register, $src$$Register, 0x3f);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8684
  %}
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8685
  ins_pipe(pipe_class_default);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8686
%}
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8687
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8688
// 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
  8689
// positive longs and 0xF...F for negative ones.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  8690
instruct signmask64L_regL(iRegLdst dst, iRegLsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8691
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8692
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8693
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8694
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8695
  format %{ "SRADI   $dst, $src, #63" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8696
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8697
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8698
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8699
    __ sradi($dst$$Register, $src$$Register, 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8700
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8701
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8704
// Long negation
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8705
instruct negL_reg_reg(iRegLdst dst, immL_0 zero, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8706
  match(Set dst (SubL zero src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8707
  format %{ "NEG     $dst, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8708
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8709
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8710
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8711
    __ neg($dst$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8712
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8713
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8716
// NegL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8717
instruct negI_con0_regL(iRegIdst dst, immL_0 zero, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8718
  match(Set dst (ConvL2I (SubL zero src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8719
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8720
  format %{ "NEG     $dst, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8721
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8722
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8723
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8724
    __ neg($dst$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8727
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8728
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8729
// Multiplication Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8730
// Integer Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8731
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8732
// Register Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8733
instruct mulI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8734
  match(Set dst (MulI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8735
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8736
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8737
  format %{ "MULLW   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8738
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8739
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8740
    // TODO: PPC port $archOpcode(ppc64Opcode_mullw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8741
    __ mullw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8742
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8743
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8744
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8745
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8746
// Immediate Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8747
instruct mulI_reg_imm16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8748
  match(Set dst (MulI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8749
  ins_cost(DEFAULT_COST);
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
  format %{ "MULLI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8752
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8753
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8754
    // TODO: PPC port $archOpcode(ppc64Opcode_mulli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8755
    __ mulli($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8756
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8757
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8758
%}
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
instruct mulL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8761
  match(Set dst (MulL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8762
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8763
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8764
  format %{ "MULLD   $dst $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8765
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8766
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8767
    // TODO: PPC port $archOpcode(ppc64Opcode_mulld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8768
    __ mulld($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8769
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8770
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8771
%}
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
// Multiply high for optimized long division by constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8774
instruct mulHighL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8775
  match(Set dst (MulHiL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8776
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8777
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8778
  format %{ "MULHD   $dst $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8779
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8780
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8781
    // TODO: PPC port $archOpcode(ppc64Opcode_mulhd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8782
    __ mulhd($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8785
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8786
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8787
// Immediate Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8788
instruct mulL_reg_imm16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8789
  match(Set dst (MulL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8790
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8791
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8792
  format %{ "MULLI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8793
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8794
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8795
    // TODO: PPC port $archOpcode(ppc64Opcode_mulli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8796
    __ mulli($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8797
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8798
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8799
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8800
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8801
// Integer Division with Immediate -1: Negate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8802
instruct divI_reg_immIvalueMinus1(iRegIdst dst, iRegIsrc src1, immI_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8803
  match(Set dst (DivI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8804
  ins_cost(DEFAULT_COST);
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
  format %{ "NEG     $dst, $src1 \t// /-1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8807
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8808
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8809
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8810
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8811
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8812
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8813
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8814
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8815
// Integer Division with constant, but not -1.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8816
// 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
  8817
// It might well be that src2 is known to be positive.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8818
instruct divI_reg_regnotMinus1(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8819
  match(Set dst (DivI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8820
  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
  8821
  ins_cost(2*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8822
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8823
  format %{ "DIVW    $dst, $src1, $src2 \t// /not-1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8824
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8825
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8826
    // TODO: PPC port $archOpcode(ppc64Opcode_divw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8827
    __ divw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8828
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8829
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8830
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8831
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8832
instruct cmovI_bne_negI_reg(iRegIdst dst, flagsRegSrc crx, iRegIsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8833
  effect(USE_DEF dst, USE src1, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8834
  predicate(false);
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
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8837
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8838
  format %{ "CMOVE   $dst, neg($src1), $crx" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8839
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8840
  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
  8841
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8842
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8843
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8844
    __ bne($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8845
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8846
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8847
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8848
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8849
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8850
%}
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
// Integer Division with Registers not containing constants.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8853
instruct divI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8854
  match(Set dst (DivI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8855
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8856
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8857
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8858
    immI16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8859
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8860
    cmpI_reg_imm16(tmp1, src2, imm);          // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8861
    divI_reg_regnotMinus1(dst, src1, src2);   // dst = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8862
    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
  8863
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8864
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8865
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8866
// Long Division with Immediate -1: Negate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8867
instruct divL_reg_immLvalueMinus1(iRegLdst dst, iRegLsrc src1, immL_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8868
  match(Set dst (DivL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8869
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8870
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8871
  format %{ "NEG     $dst, $src1 \t// /-1, long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8872
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8873
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8874
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8875
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8876
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8877
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8878
%}
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
// Long Division with constant, but not -1.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8881
instruct divL_reg_regnotMinus1(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8882
  match(Set dst (DivL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8883
  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
  8884
  ins_cost(2*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8885
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8886
  format %{ "DIVD    $dst, $src1, $src2 \t// /not-1, long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8887
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8888
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8889
    // TODO: PPC port $archOpcode(ppc64Opcode_divd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8890
    __ divd($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8891
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8892
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8893
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8894
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8895
instruct cmovL_bne_negL_reg(iRegLdst dst, flagsRegSrc crx, iRegLsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8896
  effect(USE_DEF dst, USE src1, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8897
  predicate(false);
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_variable_size_depending_on_alignment(true);
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
  format %{ "CMOVE   $dst, neg($src1), $crx" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8902
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8903
  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
  8904
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8905
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8906
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8907
    __ bne($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8908
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8909
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8910
    __ bind(done);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8913
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8914
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8915
// Long Division with Registers not containing constants.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8916
instruct divL_reg_reg_Ex(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8917
  match(Set dst (DivL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8918
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8919
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8920
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8921
    immL16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8922
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8923
    cmpL_reg_imm16(tmp1, src2, imm);          // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8924
    divL_reg_regnotMinus1(dst, src1, src2);   // dst = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8925
    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
  8926
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8927
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8928
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8929
// Integer Remainder with registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8930
instruct modI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8931
  match(Set dst (ModI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8932
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8933
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8934
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8935
    immI16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8936
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8937
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8938
    iRegIdst tmp3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8939
    cmpI_reg_imm16(tmp1, src2, imm);           // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8940
    divI_reg_regnotMinus1(tmp2, src1, src2);   // tmp2 = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8941
    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
  8942
    mulI_reg_reg(tmp3, src2, tmp2);            // tmp3 = src2 * tmp2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8943
    subI_reg_reg(dst, src1, tmp3);             // dst = src1 - tmp3
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8944
  %}
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8947
// Long Remainder with registers
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8948
instruct modL_reg_reg_Ex(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8949
  match(Set dst (ModL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8950
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8951
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8952
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8953
    immL16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8954
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8955
    iRegLdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8956
    iRegLdst tmp3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8957
    cmpL_reg_imm16(tmp1, src2, imm);             // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8958
    divL_reg_regnotMinus1(tmp2, src1, src2);     // tmp2 = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8959
    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
  8960
    mulL_reg_reg(tmp3, src2, tmp2);              // tmp3 = src2 * tmp2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8961
    subL_reg_reg(dst, src1, tmp3);               // dst = src1 - tmp3
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8962
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8963
%}
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
// Integer Shift Instructions
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
// Register Shift Left
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8968
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8969
// Clear all but the lowest #mask bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8970
// Used to normalize shift amounts in registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8971
instruct maskI_reg_imm(iRegIdst dst, iRegIsrc src, uimmI6 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8972
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8973
  effect(DEF dst, USE src, USE mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8974
  predicate(false);
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
  format %{ "MASK    $dst, $src, $mask \t// clear $mask upper bits" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8977
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8978
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8979
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8980
    __ clrldi($dst$$Register, $src$$Register, $mask$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8981
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8982
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8985
instruct lShiftI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8986
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8987
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8988
  predicate(false);
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
  format %{ "SLW     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8991
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8992
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8993
    // TODO: PPC port $archOpcode(ppc64Opcode_slw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8994
    __ slw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8995
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8996
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8997
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8998
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8999
instruct lShiftI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9000
  match(Set dst (LShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9001
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9002
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9003
    uimmI6 mask %{ 0x3b /* clear 59 bits, keep 5 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9004
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9005
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9006
    lShiftI_reg_reg(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9007
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9008
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9009
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9010
// Register Shift Left Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9011
instruct lShiftI_reg_imm(iRegIdst dst, iRegIsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9012
  match(Set dst (LShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9013
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9014
  format %{ "SLWI    $dst, $src1, ($src2 & 0x1f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9015
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9016
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9017
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9018
    __ slwi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x1f);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9021
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9022
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9023
// AndI with negpow2-constant + LShiftI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9024
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
  9025
  match(Set dst (LShiftI (AndI src1 src2) src3));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9026
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9027
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9028
  format %{ "RLWINM  $dst, lShiftI(AndI($src1, $src2), $src3)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9029
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9030
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9031
    // 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
  9032
    long src2      = $src2$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9033
    long src3      = $src3$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9034
    long maskbits  = src3 + log2_long((jlong) (julong) (juint) -src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9035
    if (maskbits >= 32) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9036
      __ li($dst$$Register, 0); // addi
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9037
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9038
      __ rlwinm($dst$$Register, $src1$$Register, src3 & 0x1f, 0, (31-maskbits) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9039
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9040
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9041
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9044
// RShiftI + AndI with negpow2-constant + LShiftI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9045
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
  9046
  match(Set dst (LShiftI (AndI (RShiftI src1 src3) src2) src3));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9047
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9048
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9049
  format %{ "RLWINM  $dst, lShiftI(AndI(RShiftI($src1, $src3), $src2), $src3)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9050
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9051
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9052
    // 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
  9053
    long src2      = $src2$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9054
    long src3      = $src3$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9055
    long maskbits  = src3 + log2_long((jlong) (julong) (juint) -src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9056
    if (maskbits >= 32) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9057
      __ li($dst$$Register, 0); // addi
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9058
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9059
      __ rlwinm($dst$$Register, $src1$$Register, 0, 0, (31-maskbits) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9060
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9061
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9062
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9063
%}
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
instruct lShiftL_regL_regI(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9066
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9067
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9068
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9069
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9070
  format %{ "SLD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9071
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9072
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9073
    // TODO: PPC port $archOpcode(ppc64Opcode_sld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9074
    __ sld($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9075
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9076
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9077
%}
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
// Register Shift Left
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9080
instruct lShiftL_regL_regI_Ex(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9081
  match(Set dst (LShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9082
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9083
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9084
    uimmI6 mask %{ 0x3a /* clear 58 bits, keep 6 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9085
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9086
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9087
    lShiftL_regL_regI(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9088
  %}
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9091
// Register Shift Left Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9092
instruct lshiftL_regL_immI(iRegLdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9093
  match(Set dst (LShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9094
  format %{ "SLDI    $dst, $src1, ($src2 & 0x3f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9095
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9096
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9097
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9098
    __ sldi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9099
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9100
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9103
// If we shift more than 32 bits, we need not convert I2L.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9104
instruct lShiftL_regI_immGE32(iRegLdst dst, iRegIsrc src1, uimmI6_ge32 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9105
  match(Set dst (LShiftL (ConvI2L src1) src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9106
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9107
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9108
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9109
  format %{ "SLDI    $dst, i2l($src1), $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9110
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9111
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9112
    __ sldi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9115
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9116
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9117
// Shift a postivie int to the left.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9118
// Clrlsldi clears the upper 32 bits and shifts.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9119
instruct scaledPositiveI2L_lShiftL_convI2L_reg_imm6(iRegLdst dst, iRegIsrc src1, uimmI6 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9120
  match(Set dst (LShiftL (ConvI2L src1) src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9121
  predicate(((ConvI2LNode*)(_kids[0]->_leaf))->type()->is_long()->is_positive_int());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9122
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9123
  format %{ "SLDI    $dst, i2l(positive_int($src1)), $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9124
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9125
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9126
    // TODO: PPC port $archOpcode(ppc64Opcode_rldic);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9127
    __ clrlsldi($dst$$Register, $src1$$Register, 0x20, $src2$$constant);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9130
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9131
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9132
instruct arShiftI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9133
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9134
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9135
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9136
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9137
  format %{ "SRAW    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9138
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9139
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9140
    // TODO: PPC port $archOpcode(ppc64Opcode_sraw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9141
    __ sraw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9142
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9143
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9144
%}
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
// Register Arithmetic Shift Right
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9147
instruct arShiftI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9148
  match(Set dst (RShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9149
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9150
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9151
    uimmI6 mask %{ 0x3b /* clear 59 bits, keep 5 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9152
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9153
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9154
    arShiftI_reg_reg(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9155
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9156
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9157
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9158
// Register Arithmetic Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9159
instruct arShiftI_reg_imm(iRegIdst dst, iRegIsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9160
  match(Set dst (RShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9161
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9162
  format %{ "SRAWI   $dst, $src1, ($src2 & 0x1f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9163
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9164
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9165
    // TODO: PPC port $archOpcode(ppc64Opcode_srawi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9166
    __ srawi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x1f);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9169
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9170
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9171
instruct arShiftL_regL_regI(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9172
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9173
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9174
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9175
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9176
  format %{ "SRAD    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9177
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9178
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9179
    // TODO: PPC port $archOpcode(ppc64Opcode_srad);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9180
    __ srad($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9183
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9184
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9185
// Register Shift Right Arithmetic Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9186
instruct arShiftL_regL_regI_Ex(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9187
  match(Set dst (RShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9188
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9189
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9190
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9191
    uimmI6 mask %{ 0x3a /* clear 58 bits, keep 6 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9192
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9193
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9194
    arShiftL_regL_regI(dst, src1, tmpI);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9197
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9198
// Register Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9199
instruct arShiftL_regL_immI(iRegLdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9200
  match(Set dst (RShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9201
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9202
  format %{ "SRADI   $dst, $src1, ($src2 & 0x3f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9203
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9204
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9205
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9206
    __ sradi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9209
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9210
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9211
// RShiftL + ConvL2I
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9212
instruct convL2I_arShiftL_regL_immI(iRegIdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9213
  match(Set dst (ConvL2I (RShiftL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9214
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9215
  format %{ "SRADI   $dst, $src1, ($src2 & 0x3f) \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9216
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9217
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9218
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9219
    __ sradi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9220
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9221
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9222
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9223
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9224
instruct urShiftI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9225
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9226
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9227
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9228
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9229
  format %{ "SRW     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9230
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9231
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9232
    // TODO: PPC port $archOpcode(ppc64Opcode_srw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9233
    __ srw($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9238
// Register Shift Right
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9239
instruct urShiftI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9240
  match(Set dst (URShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9241
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9242
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9243
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9244
    uimmI6 mask %{ 0x3b /* clear 59 bits, keep 5 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9245
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9246
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9247
    urShiftI_reg_reg(dst, src1, tmpI);
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
%}
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
// Register Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9252
instruct urShiftI_reg_imm(iRegIdst dst, iRegIsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9253
  match(Set dst (URShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9254
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9255
  format %{ "SRWI    $dst, $src1, ($src2 & 0x1f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9256
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9257
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9258
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9259
    __ srwi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9260
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9261
  ins_pipe(pipe_class_default);
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
instruct urShiftL_regL_regI(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9265
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9266
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9267
  predicate(false);
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 %{ "SRD     $dst, $src1, $src2" %}
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 %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9272
    // TODO: PPC port $archOpcode(ppc64Opcode_srd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9273
    __ srd($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9276
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9277
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9278
// Register Shift Right
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9279
instruct urShiftL_regL_regI_Ex(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9280
  match(Set dst (URShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9281
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9282
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9283
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9284
    uimmI6 mask %{ 0x3a /* clear 58 bits, keep 6 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9285
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9286
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9287
    urShiftL_regL_regI(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9288
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9289
%}
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
// Register Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9292
instruct urShiftL_regL_immI(iRegLdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9293
  match(Set dst (URShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9294
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9295
  format %{ "SRDI    $dst, $src1, ($src2 & 0x3f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9296
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9297
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9298
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9299
    __ srdi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9300
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9301
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9302
%}
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
// URShiftL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9305
instruct convL2I_urShiftL_regL_immI(iRegIdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9306
  match(Set dst (ConvL2I (URShiftL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9307
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9308
  format %{ "SRDI    $dst, $src1, ($src2 & 0x3f) \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9309
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9310
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9311
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9312
    __ srdi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9313
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9314
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9315
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9316
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9317
// Register Shift Right Immediate with a CastP2X
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9318
instruct shrP_convP2X_reg_imm6(iRegLdst dst, iRegP_N2P src1, uimmI6 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9319
  match(Set dst (URShiftL (CastP2X src1) src2));
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
  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
  9322
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9323
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9324
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9325
    __ srdi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9326
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9327
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9328
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9329
46555
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9330
// Bitfield Extract: URShiftI + AndI
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9331
instruct andI_urShiftI_regI_immI_immIpow2minus1(iRegIdst dst, iRegIsrc src1, immI src2, immIpow2minus1 src3) %{
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9332
  match(Set dst (AndI (URShiftI src1 src2) src3));
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9333
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9334
  format %{ "EXTRDI  $dst, $src1, shift=$src2, mask=$src3 \t// int bitfield extract" %}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9335
  size(4);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9336
  ins_encode %{
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9337
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9338
    int rshift = ($src2$$constant) & 0x1f;
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9339
    int length = log2_long(((jlong) $src3$$constant) + 1);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9340
    if (rshift + length > 32) {
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9341
      // if necessary, adjust mask to omit rotated bits.
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9342
      length = 32 - rshift;
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9343
    }
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9344
    __ extrdi($dst$$Register, $src1$$Register, length, 64 - (rshift + length));
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9345
  %}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9346
  ins_pipe(pipe_class_default);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9347
%}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9348
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9349
// Bitfield Extract: URShiftL + AndL
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9350
instruct andL_urShiftL_regL_immI_immLpow2minus1(iRegLdst dst, iRegLsrc src1, immI src2, immLpow2minus1 src3) %{
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9351
  match(Set dst (AndL (URShiftL src1 src2) src3));
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9352
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9353
  format %{ "EXTRDI  $dst, $src1, shift=$src2, mask=$src3 \t// long bitfield extract" %}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9354
  size(4);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9355
  ins_encode %{
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9356
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9357
    int rshift  = ($src2$$constant) & 0x3f;
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9358
    int length = log2_long(((jlong) $src3$$constant) + 1);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9359
    if (rshift + length > 64) {
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9360
      // if necessary, adjust mask to omit rotated bits.
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9361
      length = 64 - rshift;
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9362
    }
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9363
    __ extrdi($dst$$Register, $src1$$Register, length, 64 - (rshift + length));
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9364
  %}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9365
  ins_pipe(pipe_class_default);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9366
%}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9367
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9368
instruct sxtI_reg(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9369
  match(Set dst (ConvL2I (ConvI2L src)));
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
  format %{ "EXTSW   $dst, $src \t// int->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9372
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9373
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9374
    // TODO: PPC port $archOpcode(ppc64Opcode_extsw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9375
    __ extsw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9376
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9377
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9378
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9379
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9380
//----------Rotate Instructions------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9381
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9382
// Rotate Left by 8-bit immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9383
instruct rotlI_reg_immi8(iRegIdst dst, iRegIsrc src, immI8 lshift, immI8 rshift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9384
  match(Set dst (OrI (LShiftI src lshift) (URShiftI src rshift)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9385
  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
  9386
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9387
  format %{ "ROTLWI  $dst, $src, $lshift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9388
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9389
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9390
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9391
    __ rotlwi($dst$$Register, $src$$Register, $lshift$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9392
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9393
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9396
// Rotate Right by 8-bit immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9397
instruct rotrI_reg_immi8(iRegIdst dst, iRegIsrc src, immI8 rshift, immI8 lshift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9398
  match(Set dst (OrI (URShiftI src rshift) (LShiftI src lshift)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9399
  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
  9400
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9401
  format %{ "ROTRWI  $dst, $rshift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9402
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9403
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9404
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9405
    __ rotrwi($dst$$Register, $src$$Register, $rshift$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9406
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9407
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9408
%}
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
//----------Floating Point Arithmetic Instructions-----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9411
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9412
// Add float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9413
instruct addF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9414
  match(Set dst (AddF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9415
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9416
  format %{ "FADDS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9417
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9418
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9419
    // TODO: PPC port $archOpcode(ppc64Opcode_fadds);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9420
    __ fadds($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9423
%}
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
// Add float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9426
instruct addD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9427
  match(Set dst (AddD src1 src2));
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 %{ "FADD    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9430
  size(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_fadd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9433
    __ fadd($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
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
// Sub float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9439
instruct subF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9440
  match(Set dst (SubF src1 src2));
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 %{ "FSUBS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9443
  size(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_fsubs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9446
    __ fsubs($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
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
// Sub float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9452
instruct subD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9453
  match(Set dst (SubD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9454
  format %{ "FSUB    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9455
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9456
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9457
    // TODO: PPC port $archOpcode(ppc64Opcode_fsub);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9458
    __ fsub($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9459
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9460
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9461
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9462
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9463
// Mul float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9464
instruct mulF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9465
  match(Set dst (MulF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9466
  format %{ "FMULS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9467
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9468
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9469
    // TODO: PPC port $archOpcode(ppc64Opcode_fmuls);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9470
    __ fmuls($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9471
  %}
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
// Mul float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9476
instruct mulD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9477
  match(Set dst (MulD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9478
  format %{ "FMUL    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9479
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9480
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9481
    // TODO: PPC port $archOpcode(ppc64Opcode_fmul);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9482
    __ fmul($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9483
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9484
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9485
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9486
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9487
// Div float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9488
instruct divF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9489
  match(Set dst (DivF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9490
  format %{ "FDIVS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9491
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9492
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9493
    // TODO: PPC port $archOpcode(ppc64Opcode_fdivs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9494
    __ fdivs($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9495
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9496
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9497
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9498
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9499
// Div float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9500
instruct divD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9501
  match(Set dst (DivD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9502
  format %{ "FDIV    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9503
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9504
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9505
    // TODO: PPC port $archOpcode(ppc64Opcode_fdiv);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9506
    __ fdiv($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9507
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9508
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9509
%}
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
// Absolute float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9512
instruct absF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9513
  match(Set dst (AbsF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9514
  format %{ "FABS    $dst, $src \t// float" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9515
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9516
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9517
    // TODO: PPC port $archOpcode(ppc64Opcode_fabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9518
    __ fabs($dst$$FloatRegister, $src$$FloatRegister);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9521
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9522
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9523
// Absolute float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9524
instruct absD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9525
  match(Set dst (AbsD src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9526
  format %{ "FABS    $dst, $src \t// double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9527
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9528
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9529
    // TODO: PPC port $archOpcode(ppc64Opcode_fabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9530
    __ fabs($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9531
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9532
  ins_pipe(pipe_class_default);
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 negF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9536
  match(Set dst (NegF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9537
  format %{ "FNEG    $dst, $src \t// float" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9538
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9539
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9540
    // TODO: PPC port $archOpcode(ppc64Opcode_fneg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9541
    __ fneg($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9542
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9543
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9544
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9545
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9546
instruct negD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9547
  match(Set dst (NegD src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9548
  format %{ "FNEG    $dst, $src \t// double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9549
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9550
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9551
    // TODO: PPC port $archOpcode(ppc64Opcode_fneg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9552
    __ fneg($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9553
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9554
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9555
%}
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
// AbsF + NegF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9558
instruct negF_absF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9559
  match(Set dst (NegF (AbsF src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9560
  format %{ "FNABS   $dst, $src \t// float" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9561
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9562
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9563
    // TODO: PPC port $archOpcode(ppc64Opcode_fnabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9564
    __ fnabs($dst$$FloatRegister, $src$$FloatRegister);
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
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9569
// AbsD + NegD.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9570
instruct negD_absD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9571
  match(Set dst (NegD (AbsD src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9572
  format %{ "FNABS   $dst, $src \t// double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9573
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9574
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9575
    // TODO: PPC port $archOpcode(ppc64Opcode_fnabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9576
    __ fnabs($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9577
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9578
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9579
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9580
22879
177361c49b26 8035394: PPC64: Make usage of intrinsic dsqrt depend on processor recognition.
goetz
parents: 22874
diff changeset
  9581
// VM_Version::has_fsqrt() decides if this node will be used.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9582
// Sqrt float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9583
instruct sqrtD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9584
  match(Set dst (SqrtD src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9585
  format %{ "FSQRT   $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9586
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9587
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9588
    // TODO: PPC port $archOpcode(ppc64Opcode_fsqrt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9589
    __ fsqrt($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9590
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9591
  ins_pipe(pipe_class_default);
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
// Single-precision sqrt.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9595
instruct sqrtF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9596
  match(Set dst (ConvD2F (SqrtD (ConvF2D src))));
23492
af5352f40e65 8037915: PPC64/AIX: Several smaller fixes
goetz
parents: 23211
diff changeset
  9597
  predicate(VM_Version::has_fsqrts());
22861
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 %{ "FSQRTS  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9601
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9602
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9603
    // TODO: PPC port $archOpcode(ppc64Opcode_fsqrts);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9604
    __ fsqrts($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9605
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9606
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9607
%}
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
instruct roundDouble_nop(regD dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9610
  match(Set dst (RoundDouble dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9611
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9612
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9613
  format %{ " -- \t// RoundDouble not needed - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9614
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9615
  // PPC results are already "rounded" (i.e., normal-format IEEE).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9616
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9617
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9618
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9619
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9620
instruct roundFloat_nop(regF dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9621
  match(Set dst (RoundFloat dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9622
  ins_cost(0);
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
  format %{ " -- \t// RoundFloat not needed - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9625
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9626
  // PPC results are already "rounded" (i.e., normal-format IEEE).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9627
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9628
  ins_pipe(pipe_class_default);
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
42884
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9631
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9632
// Multiply-Accumulate
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9633
// src1 * src2 + src3
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9634
instruct maddF_reg_reg(regF dst, regF src1, regF src2, regF src3) %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9635
  match(Set dst (FmaF src3 (Binary src1 src2)));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9636
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9637
  format %{ "FMADDS  $dst, $src1, $src2, $src3" %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9638
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9639
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9640
    // TODO: PPC port $archOpcode(ppc64Opcode_fmadds);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9641
    __ fmadds($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister, $src3$$FloatRegister);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9642
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9643
  ins_pipe(pipe_class_default);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9644
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9645
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9646
// src1 * src2 + src3
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9647
instruct maddD_reg_reg(regD dst, regD src1, regD src2, regD src3) %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9648
  match(Set dst (FmaD src3 (Binary src1 src2)));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9649
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9650
  format %{ "FMADD   $dst, $src1, $src2, $src3" %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9651
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9652
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9653
    // TODO: PPC port $archOpcode(ppc64Opcode_fmadd);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9654
    __ fmadd($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister, $src3$$FloatRegister);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9655
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9656
  ins_pipe(pipe_class_default);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9657
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9658
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9659
// -src1 * src2 + src3 = -(src1*src2-src3)
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9660
instruct mnsubF_reg_reg(regF dst, regF src1, regF src2, regF src3) %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9661
  match(Set dst (FmaF src3 (Binary (NegF src1) src2)));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9662
  match(Set dst (FmaF src3 (Binary src1 (NegF src2))));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9663
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9664
  format %{ "FNMSUBS $dst, $src1, $src2, $src3" %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9665
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9666
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9667
    // TODO: PPC port $archOpcode(ppc64Opcode_fnmsubs);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9668
    __ fnmsubs($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister, $src3$$FloatRegister);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9669
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9670
  ins_pipe(pipe_class_default);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9671
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9672
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9673
// -src1 * src2 + src3 = -(src1*src2-src3)
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9674
instruct mnsubD_reg_reg(regD dst, regD src1, regD src2, regD src3) %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9675
  match(Set dst (FmaD src3 (Binary (NegD src1) src2)));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9676
  match(Set dst (FmaD src3 (Binary src1 (NegD src2))));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9677
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9678
  format %{ "FNMSUB  $dst, $src1, $src2, $src3" %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9679
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9680
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9681
    // TODO: PPC port $archOpcode(ppc64Opcode_fnmsub);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9682
    __ fnmsub($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister, $src3$$FloatRegister);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9683
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9684
  ins_pipe(pipe_class_default);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9685
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9686
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9687
// -src1 * src2 - src3 = -(src1*src2+src3)
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9688
instruct mnaddF_reg_reg(regF dst, regF src1, regF src2, regF src3) %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9689
  match(Set dst (FmaF (NegF src3) (Binary (NegF src1) src2)));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9690
  match(Set dst (FmaF (NegF src3) (Binary src1 (NegF src2))));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9691
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9692
  format %{ "FNMADDS $dst, $src1, $src2, $src3" %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9693
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9694
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9695
    // TODO: PPC port $archOpcode(ppc64Opcode_fnmadds);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9696
    __ fnmadds($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister, $src3$$FloatRegister);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9697
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9698
  ins_pipe(pipe_class_default);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9699
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9700
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9701
// -src1 * src2 - src3 = -(src1*src2+src3)
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9702
instruct mnaddD_reg_reg(regD dst, regD src1, regD src2, regD src3) %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9703
  match(Set dst (FmaD (NegD src3) (Binary (NegD src1) src2)));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9704
  match(Set dst (FmaD (NegD src3) (Binary src1 (NegD src2))));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9705
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9706
  format %{ "FNMADD  $dst, $src1, $src2, $src3" %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9707
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9708
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9709
    // TODO: PPC port $archOpcode(ppc64Opcode_fnmadd);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9710
    __ fnmadd($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister, $src3$$FloatRegister);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9711
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9712
  ins_pipe(pipe_class_default);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9713
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9714
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9715
// src1 * src2 - src3
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9716
instruct msubF_reg_reg(regF dst, regF src1, regF src2, regF src3) %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9717
  match(Set dst (FmaF (NegF src3) (Binary src1 src2)));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9718
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9719
  format %{ "FMSUBS  $dst, $src1, $src2, $src3" %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9720
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9721
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9722
    // TODO: PPC port $archOpcode(ppc64Opcode_fmsubs);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9723
    __ fmsubs($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister, $src3$$FloatRegister);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9724
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9725
  ins_pipe(pipe_class_default);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9726
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9727
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9728
// src1 * src2 - src3
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9729
instruct msubD_reg_reg(regD dst, regD src1, regD src2, regD src3) %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9730
  match(Set dst (FmaD (NegD src3) (Binary src1 src2)));
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9731
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9732
  format %{ "FMSUB   $dst, $src1, $src2, $src3" %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9733
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9734
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9735
    // TODO: PPC port $archOpcode(ppc64Opcode_fmsub);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9736
    __ fmsub($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister, $src3$$FloatRegister);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9737
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9738
  ins_pipe(pipe_class_default);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9739
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9740
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
  9741
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9742
//----------Logical Instructions-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9743
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9744
// And Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9745
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9746
// Register And
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9747
instruct andI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9748
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9749
  format %{ "AND     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9750
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9751
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9752
    // TODO: PPC port $archOpcode(ppc64Opcode_and);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9753
    __ andr($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9756
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9757
42619
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9758
// Left shifted Immediate And
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9759
instruct andI_reg_immIhi16(iRegIdst dst, iRegIsrc src1, immIhi16  src2, flagsRegCR0 cr0) %{
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9760
  match(Set dst (AndI src1 src2));
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9761
  effect(KILL cr0);
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9762
  format %{ "ANDIS   $dst, $src1, $src2.hi" %}
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9763
  size(4);
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9764
  ins_encode %{
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9765
    // TODO: PPC port $archOpcode(ppc64Opcode_andis_);
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9766
    __ andis_($dst$$Register, $src1$$Register, (int)((unsigned short)(($src2$$constant & 0xFFFF0000) >> 16)));
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9767
  %}
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9768
  ins_pipe(pipe_class_default);
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9769
%}
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
  9770
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9771
// Immediate And
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9772
instruct andI_reg_uimm16(iRegIdst dst, iRegIsrc src1, uimmI16 src2, flagsRegCR0 cr0) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9773
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9774
  effect(KILL cr0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9775
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9776
  format %{ "ANDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9777
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9778
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9779
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9780
    // FIXME: avoid andi_ ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9781
    __ andi_($dst$$Register, $src1$$Register, $src2$$constant);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9784
%}
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
// Immediate And where the immediate is a negative power of 2.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9787
instruct andI_reg_immInegpow2(iRegIdst dst, iRegIsrc src1, immInegpow2 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9788
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9789
  format %{ "ANDWI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9790
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9791
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9792
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9793
    __ clrrdi($dst$$Register, $src1$$Register, log2_long((jlong)(julong)(juint)-($src2$$constant)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9794
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9795
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9796
%}
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
instruct andI_reg_immIpow2minus1(iRegIdst dst, iRegIsrc src1, immIpow2minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9799
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9800
  format %{ "ANDWI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9801
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9802
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9803
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9804
    __ clrldi($dst$$Register, $src1$$Register, 64-log2_long((((jlong) $src2$$constant)+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9805
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9806
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9807
%}
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
instruct andI_reg_immIpowerOf2(iRegIdst dst, iRegIsrc src1, immIpowerOf2 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9810
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9811
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9812
  format %{ "ANDWI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9813
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9814
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9815
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9816
    __ rlwinm($dst$$Register, $src1$$Register, 0,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9817
              (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
  9818
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9819
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9820
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9821
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9822
// Register And Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9823
instruct andL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9824
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9825
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9826
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9827
  format %{ "AND     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9828
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9829
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9830
    // TODO: PPC port $archOpcode(ppc64Opcode_and);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9831
    __ andr($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9834
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9835
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9836
// Immediate And long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9837
instruct andL_reg_uimm16(iRegLdst dst, iRegLsrc src1, uimmL16 src2, flagsRegCR0 cr0) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9838
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9839
  effect(KILL cr0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9840
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9841
  format %{ "ANDI    $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9842
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9843
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9844
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9845
    // FIXME: avoid andi_ ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9846
    __ andi_($dst$$Register, $src1$$Register, $src2$$constant);
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
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9851
// Immediate And Long where the immediate is a negative power of 2.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9852
instruct andL_reg_immLnegpow2(iRegLdst dst, iRegLsrc src1, immLnegpow2 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9853
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9854
  format %{ "ANDDI   $dst, $src1, $src2" %}
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_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9858
    __ clrrdi($dst$$Register, $src1$$Register, log2_long((jlong)-$src2$$constant));
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
instruct andL_reg_immLpow2minus1(iRegLdst dst, iRegLsrc src1, immLpow2minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9864
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9865
  format %{ "ANDDI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9866
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9867
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9868
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9869
    __ clrldi($dst$$Register, $src1$$Register, 64-log2_long((((jlong) $src2$$constant)+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9870
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9871
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9872
%}
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
// AndL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9875
instruct convL2I_andL_reg_immLpow2minus1(iRegIdst dst, iRegLsrc src1, immLpow2minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9876
  match(Set dst (ConvL2I (AndL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9877
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9878
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9879
  format %{ "ANDDI   $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9880
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9881
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9882
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9883
    __ clrldi($dst$$Register, $src1$$Register, 64-log2_long((((jlong) $src2$$constant)+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9884
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9885
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9886
%}
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
// Or Instructions
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
// Register Or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9891
instruct orI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9892
  match(Set dst (OrI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9893
  format %{ "OR      $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9894
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9895
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9896
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9897
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9898
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9899
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9900
%}
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
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9903
instruct orI_reg_reg_2(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9904
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9905
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9906
  format %{ "OR      $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9907
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9908
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9909
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9910
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9913
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9914
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9915
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
  9916
  match(Set dst (OrI (OrI (OrI src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9917
  ins_cost(DEFAULT_COST*3);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9920
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9921
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9922
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9923
    orI_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9924
    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
  9925
    orI_reg_reg(dst, tmp1, tmp2);
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
%}
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
// Immediate Or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9930
instruct orI_reg_uimm16(iRegIdst dst, iRegIsrc src1, uimmI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9931
  match(Set dst (OrI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9932
  format %{ "ORI     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9933
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9934
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9935
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9936
    __ ori($dst$$Register, $src1$$Register, ($src2$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9937
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9938
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9939
%}
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
// Register Or Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9942
instruct orL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9943
  match(Set dst (OrL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9944
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9945
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9946
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9947
  format %{ "OR      $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9948
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9949
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9950
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9951
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9952
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9953
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9954
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9955
// OrL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9956
instruct orI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9957
  match(Set dst (ConvL2I (OrL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9958
  ins_cost(DEFAULT_COST);
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
  format %{ "OR      $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9961
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9962
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9963
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9964
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9965
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9966
  ins_pipe(pipe_class_default);
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
// Immediate Or long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9970
instruct orL_reg_uimm16(iRegLdst dst, iRegLsrc src1, uimmL16 con) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9971
  match(Set dst (OrL src1 con));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9972
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9973
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9974
  format %{ "ORI     $dst, $src1, $con \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9975
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9976
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9977
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9978
    __ ori($dst$$Register, $src1$$Register, ($con$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9979
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9980
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9981
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9982
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9983
// Xor Instructions
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
// Register Xor
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9986
instruct xorI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9987
  match(Set dst (XorI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9988
  format %{ "XOR     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9989
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9990
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9991
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9992
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9993
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9994
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9995
%}
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
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9998
instruct xorI_reg_reg_2(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9999
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10000
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10001
  format %{ "XOR     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10002
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10003
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10004
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10005
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10006
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10007
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10008
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10009
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10010
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
 10011
  match(Set dst (XorI (XorI (XorI src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10012
  ins_cost(DEFAULT_COST*3);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10015
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10016
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10017
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10018
    xorI_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10019
    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
 10020
    xorI_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10021
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10022
%}
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
// Immediate Xor
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10025
instruct xorI_reg_uimm16(iRegIdst dst, iRegIsrc src1, uimmI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10026
  match(Set dst (XorI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10027
  format %{ "XORI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10028
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10029
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10030
    // TODO: PPC port $archOpcode(ppc64Opcode_xori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10031
    __ xori($dst$$Register, $src1$$Register, $src2$$constant);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10034
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10035
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10036
// Register Xor Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10037
instruct xorL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10038
  match(Set dst (XorL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10039
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10040
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10041
  format %{ "XOR     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10042
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10043
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10044
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10045
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10046
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10047
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10048
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10049
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10050
// XorL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10051
instruct xorI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10052
  match(Set dst (ConvL2I (XorL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10053
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10054
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10055
  format %{ "XOR     $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10056
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10057
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10058
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10059
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10060
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10061
  ins_pipe(pipe_class_default);
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
// Immediate Xor Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10065
instruct xorL_reg_uimm16(iRegLdst dst, iRegLsrc src1, uimmL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10066
  match(Set dst (XorL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10067
  ins_cost(DEFAULT_COST);
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 %{ "XORI    $dst, $src1, $src2 \t// long" %}
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_xori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10073
    __ xori($dst$$Register, $src1$$Register, $src2$$constant);
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
instruct notI_reg(iRegIdst dst, iRegIsrc src1, immI_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10079
  match(Set dst (XorI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10080
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10081
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10082
  format %{ "NOT     $dst, $src1 ($src2)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10083
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10084
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10085
    // TODO: PPC port $archOpcode(ppc64Opcode_nor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10086
    __ nor($dst$$Register, $src1$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10087
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10088
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10089
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10090
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10091
instruct notL_reg(iRegLdst dst, iRegLsrc src1, immL_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10092
  match(Set dst (XorL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10093
  ins_cost(DEFAULT_COST);
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
  format %{ "NOT     $dst, $src1 ($src2) \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10096
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10097
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10098
    // TODO: PPC port $archOpcode(ppc64Opcode_nor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10099
    __ nor($dst$$Register, $src1$$Register, $src1$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10102
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10103
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10104
// And-complement
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10105
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
 10106
  match(Set dst (AndI (XorI src1 src2) src3));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10107
  ins_cost(DEFAULT_COST);
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
  format %{ "ANDW    $dst, xori($src1, $src2), $src3" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10110
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10111
  ins_encode( enc_andc(dst, src3, src1) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10112
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10113
%}
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
// And-complement
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10116
instruct andcL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10117
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10118
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10119
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10120
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10121
  format %{ "ANDC    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10122
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10123
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10124
    // TODO: PPC port $archOpcode(ppc64Opcode_andc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10125
    __ andc($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10126
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10127
  ins_pipe(pipe_class_default);
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
//----------Moves between int/long and float/double----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10131
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10132
// The following rules move values from int/long registers/stack-locations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10133
// to float/double registers/stack-locations and vice versa, without doing any
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10134
// conversions. These rules are used to implement the bit-conversion methods
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10135
// of java.lang.Float etc., e.g.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10136
//   int   floatToIntBits(float value)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10137
//   float intBitsToFloat(int bits)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10138
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10139
// Notes on the implementation on ppc64:
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10140
// For Power7 and earlier, the rules are limited to those which move between a
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10141
// register and a stack-location, because we always have to go through memory
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10142
// when moving between a float register and an integer register.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10143
// This restriction is removed in Power8 with the introduction of the mtfprd
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10144
// and mffprd instructions.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10145
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10146
instruct moveL2D_reg(regD dst, iRegLsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10147
  match(Set dst (MoveL2D src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10148
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10149
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10150
  format %{ "MTFPRD  $dst, $src" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10151
  size(4);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10152
  ins_encode %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10153
    __ mtfprd($dst$$FloatRegister, $src$$Register);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10154
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10155
  ins_pipe(pipe_class_default);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10156
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10157
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10158
instruct moveI2D_reg(regD dst, iRegIsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10159
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10160
  effect(DEF dst, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10161
  predicate(false);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10162
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10163
  format %{ "MTFPRWA $dst, $src" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10164
  size(4);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10165
  ins_encode %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10166
    __ mtfprwa($dst$$FloatRegister, $src$$Register);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10167
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10168
  ins_pipe(pipe_class_default);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10169
%}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10170
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10171
//---------- Chain stack slots between similar types --------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10172
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10173
// These are needed so that the rules below can match.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10174
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10175
// Load integer from stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10176
instruct stkI_to_regI(iRegIdst dst, stackSlotI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10177
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10178
  ins_cost(MEMORY_REF_COST);
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
  format %{ "LWZ     $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10181
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10182
  ins_encode( enc_lwz(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10183
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10184
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10185
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10186
// Store integer to stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10187
instruct regI_to_stkI(stackSlotI dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10188
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10189
  ins_cost(MEMORY_REF_COST);
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
  format %{ "STW     $src, $dst \t// stk" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10192
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10193
  ins_encode( enc_stw(src, dst) ); // rs=rt
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10194
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10195
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10196
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10197
// Load long from stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10198
instruct stkL_to_regL(iRegLdst dst, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10199
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10200
  ins_cost(MEMORY_REF_COST);
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
  format %{ "LD      $dst, $src \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10203
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10204
  ins_encode( enc_ld(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10205
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10206
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10207
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10208
// Store long to stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10209
instruct regL_to_stkL(stackSlotL dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10210
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10211
  ins_cost(MEMORY_REF_COST);
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
  format %{ "STD     $src, $dst \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10214
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10215
  ins_encode( enc_std(src, dst) ); // rs=rt
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10216
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10217
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10218
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10219
//----------Moves between int and float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10220
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10221
// Move float value from float stack-location to integer register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10222
instruct moveF2I_stack_reg(iRegIdst dst, stackSlotF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10223
  match(Set dst (MoveF2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10224
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10225
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10226
  format %{ "LWZ     $dst, $src \t// MoveF2I" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10227
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10228
  ins_encode( enc_lwz(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10229
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10230
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10231
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10232
// Move float value from float register to integer stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10233
instruct moveF2I_reg_stack(stackSlotI dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10234
  match(Set dst (MoveF2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10235
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10236
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10237
  format %{ "STFS    $src, $dst \t// MoveF2I" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10238
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10239
  ins_encode( enc_stfs(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10240
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10241
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10242
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10243
// Move integer value from integer stack-location to float register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10244
instruct moveI2F_stack_reg(regF dst, stackSlotI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10245
  match(Set dst (MoveI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10246
  ins_cost(MEMORY_REF_COST);
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 %{ "LFS     $dst, $src \t// MoveI2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10249
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10250
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10251
    // TODO: PPC port $archOpcode(ppc64Opcode_lfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10252
    int Idisp = $src$$disp + frame_slots_bias($src$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10253
    __ lfs($dst$$FloatRegister, Idisp, $src$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10254
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10255
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10256
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10257
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10258
// Move integer value from integer register to float stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10259
instruct moveI2F_reg_stack(stackSlotF dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10260
  match(Set dst (MoveI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10261
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10262
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10263
  format %{ "STW     $src, $dst \t// MoveI2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10264
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10265
  ins_encode( enc_stw(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10266
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10267
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10268
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10269
//----------Moves between long and float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10270
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10271
instruct moveF2L_reg_stack(stackSlotL dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10272
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10273
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10274
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10275
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10276
  format %{ "storeD  $src, $dst \t// STACK" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10277
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10278
  ins_encode( enc_stfd(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10279
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10282
//----------Moves between long and double
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10283
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10284
// Move double value from double stack-location to long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10285
instruct moveD2L_stack_reg(iRegLdst dst, stackSlotD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10286
  match(Set dst (MoveD2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10287
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10288
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10289
  format %{ "LD      $dst, $src \t// MoveD2L" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10290
  ins_encode( enc_ld(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10291
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10292
%}
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
// Move double value from double register to long stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10295
instruct moveD2L_reg_stack(stackSlotL dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10296
  match(Set dst (MoveD2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10297
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10298
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10299
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10300
  format %{ "STFD    $src, $dst \t// MoveD2L" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10301
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10302
  ins_encode( enc_stfd(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10303
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10306
// Move long value from long stack-location to double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10307
instruct moveL2D_stack_reg(regD dst, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10308
  match(Set dst (MoveL2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10309
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10310
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10311
  format %{ "LFD     $dst, $src \t// MoveL2D" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10312
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10313
  ins_encode( enc_lfd(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10314
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10315
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10316
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10317
// Move long value from long register to double stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10318
instruct moveL2D_reg_stack(stackSlotD dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10319
  match(Set dst (MoveL2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10320
  ins_cost(MEMORY_REF_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
  format %{ "STD     $src, $dst \t// MoveL2D" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10323
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10324
  ins_encode( enc_std(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10325
  ins_pipe(pipe_class_memory);
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
//----------Register Move Instructions-----------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10329
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10330
// Replicate for Superword
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10331
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10332
instruct moveReg(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10333
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10334
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10335
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10336
  format %{ "MR      $dst, $src \t// replicate " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10337
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10338
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10339
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10340
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10341
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10342
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10343
%}
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
//----------Cast instructions (Java-level type cast)---------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10346
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10347
// Cast Long to Pointer for unsafe natives.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10348
instruct castX2P(iRegPdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10349
  match(Set dst (CastX2P src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10350
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10351
  format %{ "MR      $dst, $src \t// Long->Ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10352
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10353
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10354
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10355
    __ mr_if_needed($dst$$Register, $src$$Register);
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
 ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10358
%}
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
// Cast Pointer to Long for unsafe natives.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10361
instruct castP2X(iRegLdst dst, iRegP_N2P src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10362
  match(Set dst (CastP2X src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10363
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10364
  format %{ "MR      $dst, $src \t// Ptr->Long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10365
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10366
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10367
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10368
    __ mr_if_needed($dst$$Register, $src$$Register);
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_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10373
instruct castPP(iRegPdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10374
  match(Set dst (CastPP dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10375
  format %{ " -- \t// castPP of $dst" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10376
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10377
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10378
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10379
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10380
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10381
instruct castII(iRegIdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10382
  match(Set dst (CastII dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10383
  format %{ " -- \t// castII of $dst" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10384
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10385
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10386
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10389
instruct checkCastPP(iRegPdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10390
  match(Set dst (CheckCastPP dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10391
  format %{ " -- \t// checkcastPP of $dst" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10392
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10393
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10394
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10395
%}
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
//----------Convert instructions-----------------------------------------------
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
// Convert to boolean.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10400
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10401
// int_to_bool(src) : { 1   if src != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10402
//                    { 0   else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10403
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10404
// strategy:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10405
// 1) Count leading zeros of 32 bit-value src,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10406
//    this returns 32 (0b10.0000) iff src == 0 and <32 otherwise.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10407
// 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
 10408
// 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
 10409
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10410
// convI2Bool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10411
instruct convI2Bool_reg__cntlz_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10412
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10413
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10414
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10415
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10416
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10417
    immI shiftAmount %{ 0x5 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10418
    uimmI16 mask %{ 0x1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10419
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10420
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10421
    countLeadingZerosI(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10422
    urShiftI_reg_imm(tmp2, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10423
    xorI_reg_uimm16(dst, tmp2, mask);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10427
instruct convI2Bool_reg__cmove(iRegIdst dst, iRegIsrc src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10428
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10429
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10430
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10431
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10432
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10433
  format %{ "CMPWI   $crx, $src, #0 \t// convI2B"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10434
            "LI      $dst, #0\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10435
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10436
            "LI      $dst, #1\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10437
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10438
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10439
  ins_encode( enc_convI2B_regI__cmove(dst, src, crx, 0x0, 0x1) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10440
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10441
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10442
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10443
// ConvI2B + XorI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10444
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
 10445
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10446
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10447
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10448
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10449
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10450
    immI shiftAmount %{ 0x5 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10451
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10452
    countLeadingZerosI(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10453
    urShiftI_reg_imm(dst, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10454
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10455
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10456
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10457
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
 10458
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10459
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10460
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10461
  ins_cost(DEFAULT_COST);
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
  format %{ "CMPWI   $crx, $src, #0 \t// Xor(convI2B($src), $mask)"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10464
            "LI      $dst, #1\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10465
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10466
            "LI      $dst, #0\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10467
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10468
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10469
  ins_encode( enc_convI2B_regI__cmove(dst, src, crx, 0x1, 0x0) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10470
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10471
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10472
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10473
// AndI 0b0..010..0 + ConvI2B
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10474
instruct convI2Bool_andI_reg_immIpowerOf2(iRegIdst dst, iRegIsrc src, immIpowerOf2 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10475
  match(Set dst (Conv2B (AndI src mask)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10476
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10477
  ins_cost(DEFAULT_COST);
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
  format %{ "RLWINM  $dst, $src, $mask \t// convI2B(AndI($src, $mask))" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10480
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10481
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10482
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10483
    __ 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
 10484
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10485
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10486
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10487
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10488
// Convert pointer to boolean.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10489
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10490
// ptr_to_bool(src) : { 1   if src != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10491
//                    { 0   else
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
// strategy:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10494
// 1) Count leading zeros of 64 bit-value src,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10495
//    this returns 64 (0b100.0000) iff src == 0 and <64 otherwise.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10496
// 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
 10497
// 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
 10498
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10499
// ConvP2B
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10500
instruct convP2Bool_reg__cntlz_Ex(iRegIdst dst, iRegP_N2P src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10501
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10502
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10503
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10504
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10505
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10506
    immI shiftAmount %{ 0x6 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10507
    uimmI16 mask %{ 0x1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10508
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10509
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10510
    countLeadingZerosP(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10511
    urShiftI_reg_imm(tmp2, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10512
    xorI_reg_uimm16(dst, tmp2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10513
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10514
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10515
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10516
instruct convP2Bool_reg__cmove(iRegIdst dst, iRegP_N2P src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10517
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10518
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10519
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10520
  ins_cost(DEFAULT_COST);
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
  format %{ "CMPDI   $crx, $src, #0 \t// convP2B"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10523
            "LI      $dst, #0\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10524
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10525
            "LI      $dst, #1\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10526
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10527
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10528
  ins_encode( enc_convP2B_regP__cmove(dst, src, crx, 0x0, 0x1) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10529
  ins_pipe(pipe_class_compare);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10532
// ConvP2B + XorI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10533
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
 10534
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10535
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10536
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10537
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10538
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10539
    immI shiftAmount %{ 0x6 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10540
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10541
    countLeadingZerosP(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10542
    urShiftI_reg_imm(dst, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10543
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10544
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10545
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10546
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
 10547
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10548
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10549
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10550
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10551
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10552
  format %{ "CMPDI   $crx, $src, #0 \t// XorI(convP2B($src), $mask)"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10553
            "LI      $dst, #1\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10554
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10555
            "LI      $dst, #0\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10556
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10557
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10558
  ins_encode( enc_convP2B_regP__cmove(dst, src, crx, 0x1, 0x0) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10559
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10560
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10561
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10562
// if src1 < src2, return -1 else return 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10563
instruct cmpLTMask_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10564
  match(Set dst (CmpLTMask src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10565
  ins_cost(DEFAULT_COST*4);
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
  expand %{
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10568
    iRegLdst src1s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10569
    iRegLdst src2s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10570
    iRegLdst diff;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10571
    convI2L_reg(src1s, src1); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10572
    convI2L_reg(src2s, src2); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10573
    subL_reg_reg(diff, src1s, src2s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10574
    // Need to consider >=33 bit result, therefore we need signmaskL.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10575
    signmask64I_regL(dst, diff);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10576
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10577
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10578
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10579
instruct cmpLTMask_reg_immI0(iRegIdst dst, iRegIsrc src1, immI_0 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10580
  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
 10581
  format %{ "SRAWI   $dst, $src1, $src2 \t// CmpLTMask" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10582
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10583
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10584
    // TODO: PPC port $archOpcode(ppc64Opcode_srawi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10585
    __ srawi($dst$$Register, $src1$$Register, 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10586
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10587
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10590
//----------Arithmetic Conversion Instructions---------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10591
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10592
// Convert to Byte  -- nop
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10593
// Convert to Short -- nop
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
// Convert to Int
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10596
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10597
instruct convB2I_reg(iRegIdst dst, iRegIsrc src, immI_24 amount) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10598
  match(Set dst (RShiftI (LShiftI src amount) amount));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10599
  format %{ "EXTSB   $dst, $src \t// byte->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10600
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10601
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10602
    // TODO: PPC port $archOpcode(ppc64Opcode_extsb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10603
    __ extsb($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10606
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10607
46521
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10608
instruct extsh(iRegIdst dst, iRegIsrc src) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10609
  effect(DEF dst, USE src);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10610
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10611
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10612
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10613
    __ extsh($dst$$Register, $src$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10614
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10615
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10616
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10617
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10618
// LShiftI 16 + RShiftI 16 converts short to int.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10619
instruct convS2I_reg(iRegIdst dst, iRegIsrc src, immI_16 amount) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10620
  match(Set dst (RShiftI (LShiftI src amount) amount));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10621
  format %{ "EXTSH   $dst, $src \t// short->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10622
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10623
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10624
    // TODO: PPC port $archOpcode(ppc64Opcode_extsh);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10625
    __ extsh($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10626
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10627
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10630
// ConvL2I + ConvI2L: Sign extend int in long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10631
instruct sxtI_L2L_reg(iRegLdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10632
  match(Set dst (ConvI2L (ConvL2I src)));
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
  format %{ "EXTSW   $dst, $src \t// long->long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10635
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10636
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10637
    // TODO: PPC port $archOpcode(ppc64Opcode_extsw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10638
    __ extsw($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10641
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10642
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10643
instruct convL2I_reg(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10644
  match(Set dst (ConvL2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10645
  format %{ "MR      $dst, $src \t// long->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10646
  // variable size, 0 or 4
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10647
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10648
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10649
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10650
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10651
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10652
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10653
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10654
instruct convD2IRaw_regD(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10655
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10656
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10657
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10658
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10659
  format %{ "FCTIWZ $dst, $src \t// convD2I, $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10660
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10661
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10662
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10663
    __ fctiwz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10664
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10665
  ins_pipe(pipe_class_default);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 10668
instruct cmovI_bso_stackSlotL(iRegIdst dst, flagsRegSrc crx, stackSlotL src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10669
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10670
  effect(DEF dst, USE crx, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10671
  predicate(false);
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_variable_size_depending_on_alignment(true);
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
  format %{ "cmovI   $crx, $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10676
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10677
  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
 10678
  ins_encode( enc_cmove_bso_stackSlotL(dst, crx, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10679
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10680
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10681
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10682
instruct cmovI_bso_reg(iRegIdst dst, flagsRegSrc crx, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10683
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10684
  effect(DEF dst, USE crx, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10685
  predicate(false);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10686
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10687
  ins_variable_size_depending_on_alignment(true);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10688
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10689
  format %{ "cmovI   $crx, $dst, $src" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10690
  // Worst case is branch + move + stop, no stop without scheduler.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10691
  size(false /* TODO: PPC PORT(InsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 12 : 8);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10692
  ins_encode( enc_cmove_bso_reg(dst, crx, src) );
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10693
  ins_pipe(pipe_class_default);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10694
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10695
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 10696
instruct cmovI_bso_stackSlotL_conLvalue0_Ex(iRegIdst dst, flagsRegSrc crx, stackSlotL mem) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10697
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10698
  effect(DEF dst, USE crx, USE mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10699
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10700
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10701
  format %{ "CmovI   $dst, $crx, $mem \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10702
  postalloc_expand %{
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
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10705
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10706
    //   region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10707
    //    \       |    |   /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10708
    //     dst=cmovI_bso_stackSlotL_conLvalue0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10709
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10710
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10711
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10712
    //   region  dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10713
    //    \       /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10714
    //     dst=loadConI16(0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10715
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10716
    //      ^  region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10717
    //      |   \       |    |    /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10718
    //      dst=cmovI_bso_stackSlotL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10719
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10720
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10721
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10722
    MachNode *m1 = new loadConI16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10723
    MachNode *m2 = new cmovI_bso_stackSlotLNode();
22861
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
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10726
    m1->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10727
    m2->add_req(n_region, n_crx, n_mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10728
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10729
    // precedences for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10730
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10731
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10732
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10733
    m1->_opnds[0] = op_dst;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10734
    m1->_opnds[1] = new immI16Oper(0);
22861
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
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10737
    m2->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10738
    m2->_opnds[2] = op_mem;
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
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10741
    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
 10742
    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
 10743
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10744
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10745
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10746
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10747
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10748
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10749
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10750
instruct cmovI_bso_reg_conLvalue0_Ex(iRegIdst dst, flagsRegSrc crx, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10751
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10752
  effect(DEF dst, USE crx, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10753
  predicate(false);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10754
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10755
  format %{ "CmovI   $dst, $crx, $src \t// postalloc expanded" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10756
  postalloc_expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10757
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10758
    // replaces
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10759
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10760
    //   region  dst  crx  src
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10761
    //    \       |    |   /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10762
    //     dst=cmovI_bso_reg_conLvalue0
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10763
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10764
    // with
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10765
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10766
    //   region  dst
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10767
    //    \       /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10768
    //     dst=loadConI16(0)
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10769
    //      |
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10770
    //      ^  region  dst  crx  src
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10771
    //      |   \       |    |    /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10772
    //      dst=cmovI_bso_reg
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10773
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10774
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10775
    // Create new nodes.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10776
    MachNode *m1 = new loadConI16Node();
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10777
    MachNode *m2 = new cmovI_bso_regNode();
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10778
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10779
    // inputs for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10780
    m1->add_req(n_region);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10781
    m2->add_req(n_region, n_crx, n_src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10782
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10783
    // precedences for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10784
    m2->add_prec(m1);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10785
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10786
    // operands for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10787
    m1->_opnds[0] = op_dst;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10788
    m1->_opnds[1] = new immI16Oper(0);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10789
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10790
    m2->_opnds[0] = op_dst;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10791
    m2->_opnds[1] = op_crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10792
    m2->_opnds[2] = op_src;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10793
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10794
    // registers for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10795
    ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10796
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10797
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10798
    // Insert new nodes.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10799
    nodes->push(m1);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10800
    nodes->push(m2);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10801
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10802
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10803
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10804
// Double to Int conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10805
instruct convD2I_reg_ExEx(iRegIdst dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10806
  match(Set dst (ConvD2I src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10807
  predicate(!VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10808
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10809
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10810
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10811
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10812
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10813
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10814
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10815
    convD2IRaw_regD(tmpD, src);                         // Convert float to int (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10816
    moveD2L_reg_stack(tmpS, tmpD);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10817
    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
 10818
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10819
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10820
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10821
// Double to Int conversion, NaN is mapped to 0. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10822
instruct convD2I_reg_mffprd_ExEx(iRegIdst dst, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10823
  match(Set dst (ConvD2I src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10824
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10825
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10826
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10827
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10828
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10829
    flagsReg crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10830
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10831
    convD2IRaw_regD(tmpD, src);                         // Convert float to int (speculated).
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10832
    cmovI_bso_reg_conLvalue0_Ex(dst, crx, tmpD);        // Cmove based on NaN check.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10833
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10834
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10835
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10836
instruct convF2IRaw_regF(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10837
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10838
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10839
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10840
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10841
  format %{ "FCTIWZ $dst, $src \t// convF2I, $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10842
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10843
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10844
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10845
    __ fctiwz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10846
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10847
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10848
%}
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
// Float to Int conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10851
instruct convF2I_regF_ExEx(iRegIdst dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10852
  match(Set dst (ConvF2I src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10853
  predicate(!VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10854
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10855
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10856
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10857
    regF tmpF;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10858
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10859
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10860
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10861
    convF2IRaw_regF(tmpF, src);                         // Convert float to int (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10862
    moveF2L_reg_stack(tmpS, tmpF);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10863
    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
 10864
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10865
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10866
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10867
// Float to Int conversion, NaN is mapped to 0. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10868
instruct convF2I_regF_mffprd_ExEx(iRegIdst dst, regF src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10869
  match(Set dst (ConvF2I src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10870
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10871
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10872
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10873
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10874
    regF tmpF;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10875
    flagsReg crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10876
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10877
    convF2IRaw_regF(tmpF, src);                         // Convert float to int (speculated).
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10878
    cmovI_bso_reg_conLvalue0_Ex(dst, crx, tmpF);        // Cmove based on NaN check.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10879
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10880
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10881
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10882
// Convert to Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10883
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10884
instruct convI2L_reg(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10885
  match(Set dst (ConvI2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10886
  format %{ "EXTSW   $dst, $src \t// int->long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10887
  size(4);
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_extsw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10890
    __ extsw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10891
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10892
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10893
%}
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
// Zero-extend: convert unsigned int to long (convUI2L).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10896
instruct zeroExtendL_regI(iRegLdst dst, iRegIsrc src, immL_32bits mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10897
  match(Set dst (AndL (ConvI2L src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10898
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10899
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10900
  format %{ "CLRLDI  $dst, $src, #32 \t// zero-extend int to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10901
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10902
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10903
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10904
    __ clrldi($dst$$Register, $src$$Register, 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10905
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10906
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10907
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10908
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10909
// Zero-extend: convert unsigned int to long in long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10910
instruct zeroExtendL_regL(iRegLdst dst, iRegLsrc src, immL_32bits mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10911
  match(Set dst (AndL src mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10912
  ins_cost(DEFAULT_COST);
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
  format %{ "CLRLDI  $dst, $src, #32 \t// zero-extend int to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10915
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10916
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10917
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10918
    __ clrldi($dst$$Register, $src$$Register, 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10919
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10920
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10921
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10922
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10923
instruct convF2LRaw_regF(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10924
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10925
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10926
  predicate(false);
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
  format %{ "FCTIDZ $dst, $src \t// convF2L, $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10929
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10930
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10931
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10932
    __ fctidz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10933
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10934
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10935
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10936
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 10937
instruct cmovL_bso_stackSlotL(iRegLdst dst, flagsRegSrc crx, stackSlotL src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10938
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10939
  effect(DEF dst, USE crx, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10940
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10941
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10942
  ins_variable_size_depending_on_alignment(true);
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
  format %{ "cmovL   $crx, $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10945
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10946
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10947
  ins_encode( enc_cmove_bso_stackSlotL(dst, crx, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10948
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10949
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10950
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10951
instruct cmovL_bso_reg(iRegLdst dst, flagsRegSrc crx, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10952
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10953
  effect(DEF dst, USE crx, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10954
  predicate(false);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10955
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10956
  ins_variable_size_depending_on_alignment(true);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10957
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10958
  format %{ "cmovL   $crx, $dst, $src" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10959
  // Worst case is branch + move + stop, no stop without scheduler.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10960
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10961
  ins_encode( enc_cmove_bso_reg(dst, crx, src) );
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10962
  ins_pipe(pipe_class_default);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10963
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10964
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 10965
instruct cmovL_bso_stackSlotL_conLvalue0_Ex(iRegLdst dst, flagsRegSrc crx, stackSlotL mem) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10966
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10967
  effect(DEF dst, USE crx, USE mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10968
  predicate(false);
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
  format %{ "CmovL   $dst, $crx, $mem \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10971
  postalloc_expand %{
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
    // replaces
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
    //   region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10976
    //    \       |    |   /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10977
    //     dst=cmovL_bso_stackSlotL_conLvalue0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10978
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10979
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10980
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10981
    //   region  dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10982
    //    \       /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10983
    //     dst=loadConL16(0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10984
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10985
    //      ^  region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10986
    //      |   \       |    |    /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10987
    //      dst=cmovL_bso_stackSlotL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10988
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10989
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10990
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10991
    MachNode *m1 = new loadConL16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 10992
    MachNode *m2 = new cmovL_bso_stackSlotLNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10993
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10994
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10995
    m1->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10996
    m2->add_req(n_region, n_crx, n_mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10997
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10998
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10999
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11000
    m1->_opnds[0] = op_dst;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11001
    m1->_opnds[1] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11002
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11003
    m2->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11004
    m2->_opnds[2] = op_mem;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11005
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11006
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11007
    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
 11008
    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
 11009
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11010
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11011
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11012
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11013
  %}
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
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11016
instruct cmovL_bso_reg_conLvalue0_Ex(iRegLdst dst, flagsRegSrc crx, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11017
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11018
  effect(DEF dst, USE crx, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11019
  predicate(false);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11020
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11021
  format %{ "CmovL   $dst, $crx, $src \t// postalloc expanded" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11022
  postalloc_expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11023
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11024
    // replaces
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11025
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11026
    //   region  dst  crx  src
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11027
    //    \       |    |   /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11028
    //     dst=cmovL_bso_reg_conLvalue0
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11029
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11030
    // with
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11031
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11032
    //   region  dst
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11033
    //    \       /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11034
    //     dst=loadConL16(0)
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11035
    //      |
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11036
    //      ^  region  dst  crx  src
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11037
    //      |   \       |    |    /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11038
    //      dst=cmovL_bso_reg
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11039
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11040
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11041
    // Create new nodes.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11042
    MachNode *m1 = new loadConL16Node();
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11043
    MachNode *m2 = new cmovL_bso_regNode();
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11044
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11045
    // inputs for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11046
    m1->add_req(n_region);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11047
    m2->add_req(n_region, n_crx, n_src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11048
    m2->add_prec(m1);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11049
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11050
    // operands for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11051
    m1->_opnds[0] = op_dst;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11052
    m1->_opnds[1] = new immL16Oper(0);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11053
    m2->_opnds[0] = op_dst;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11054
    m2->_opnds[1] = op_crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11055
    m2->_opnds[2] = op_src;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11056
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11057
    // registers for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11058
    ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11059
    ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); // dst
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11060
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11061
    // Insert new nodes.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11062
    nodes->push(m1);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11063
    nodes->push(m2);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11064
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11065
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11066
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11067
// Float to Long conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11068
instruct convF2L_reg_ExEx(iRegLdst dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11069
  match(Set dst (ConvF2L src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11070
  predicate(!VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11071
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11072
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11073
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11074
    regF tmpF;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11075
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11076
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11077
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11078
    convF2LRaw_regF(tmpF, src);                         // Convert float to long (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11079
    moveF2L_reg_stack(tmpS, tmpF);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11080
    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
 11081
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11082
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11083
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11084
// Float to Long conversion, NaN is mapped to 0. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11085
instruct convF2L_reg_mffprd_ExEx(iRegLdst dst, regF src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11086
  match(Set dst (ConvF2L src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11087
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11088
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11089
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11090
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11091
    regF tmpF;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11092
    flagsReg crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11093
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11094
    convF2LRaw_regF(tmpF, src);                         // Convert float to long (speculated).
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11095
    cmovL_bso_reg_conLvalue0_Ex(dst, crx, tmpF);        // Cmove based on NaN check.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11096
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11097
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11098
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11099
instruct convD2LRaw_regD(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11100
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11101
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11102
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11103
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11104
  format %{ "FCTIDZ $dst, $src \t// convD2L $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11105
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11106
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11107
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11108
    __ fctidz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11109
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11110
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11111
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11112
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11113
// Double to Long conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11114
instruct convD2L_reg_ExEx(iRegLdst dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11115
  match(Set dst (ConvD2L src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11116
  predicate(!VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11117
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11118
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11119
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11120
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11121
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11122
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11123
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11124
    convD2LRaw_regD(tmpD, src);                         // Convert float to long (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11125
    moveD2L_reg_stack(tmpS, tmpD);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11126
    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
 11127
  %}
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
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11130
// Double to Long conversion, NaN is mapped to 0. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11131
instruct convD2L_reg_mffprd_ExEx(iRegLdst dst, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11132
  match(Set dst (ConvD2L src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11133
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11134
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11135
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11136
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11137
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11138
    flagsReg crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11139
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11140
    convD2LRaw_regD(tmpD, src);                         // Convert float to long (speculated).
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11141
    cmovL_bso_reg_conLvalue0_Ex(dst, crx, tmpD);        // Cmove based on NaN check.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11142
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11143
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11144
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11145
// Convert to Float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11146
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11147
// Placed here as needed in expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11148
instruct convL2DRaw_regD(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11149
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11150
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11151
  predicate(false);
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
  format %{ "FCFID $dst, $src \t// convL2D" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11154
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11155
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11156
    // TODO: PPC port $archOpcode(ppc64Opcode_fcfid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11157
    __ fcfid($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11158
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11159
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11160
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11161
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11162
// Placed here as needed in expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11163
instruct convD2F_reg(regF dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11164
  match(Set dst (ConvD2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11165
  format %{ "FRSP    $dst, $src \t// convD2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11166
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11167
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11168
    // TODO: PPC port $archOpcode(ppc64Opcode_frsp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11169
    __ frsp($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11170
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11171
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11172
%}
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
// Integer to Float conversion.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11175
instruct convI2F_ireg_Ex(regF dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11176
  match(Set dst (ConvI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11177
  predicate(!VM_Version::has_fcfids());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11178
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11179
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11180
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11181
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11182
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11183
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11184
    regD tmpD2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11185
    convI2L_reg(tmpL, src);              // Sign-extension int to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11186
    regL_to_stkL(tmpS, tmpL);            // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11187
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11188
    convL2DRaw_regD(tmpD2, tmpD);        // Convert to double.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11189
    convD2F_reg(dst, tmpD2);             // Convert double to float.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11190
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11191
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11192
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11193
instruct convL2FRaw_regF(regF dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11194
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11195
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11196
  predicate(false);
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
  format %{ "FCFIDS $dst, $src \t// convL2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11199
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11200
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11201
    // TODO: PPC port $archOpcode(ppc64Opcode_fcfid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11202
    __ fcfids($dst$$FloatRegister, $src$$FloatRegister);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11205
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11206
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11207
// Integer to Float conversion. Special version for Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11208
instruct convI2F_ireg_fcfids_Ex(regF dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11209
  match(Set dst (ConvI2F src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11210
  predicate(VM_Version::has_fcfids() && !VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11211
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11212
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11213
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11214
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11215
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11216
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11217
    convI2L_reg(tmpL, src);              // Sign-extension int to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11218
    regL_to_stkL(tmpS, tmpL);            // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11219
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11220
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11221
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11222
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11223
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11224
// Integer to Float conversion. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11225
instruct convI2F_ireg_mtfprd_Ex(regF dst, iRegIsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11226
  match(Set dst (ConvI2F src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11227
  predicate(VM_Version::has_fcfids() && VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11228
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11229
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11230
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11231
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11232
    moveI2D_reg(tmpD, src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11233
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11234
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11235
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11236
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11237
// L2F to avoid runtime call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11238
instruct convL2F_ireg_fcfids_Ex(regF dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11239
  match(Set dst (ConvL2F src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11240
  predicate(VM_Version::has_fcfids() && !VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11241
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11242
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11243
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11244
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11245
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11246
    regL_to_stkL(tmpS, src);             // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11247
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11248
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11249
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11250
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11251
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11252
// L2F to avoid runtime call.  Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11253
instruct convL2F_ireg_mtfprd_Ex(regF dst, iRegLsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11254
  match(Set dst (ConvL2F src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11255
  predicate(VM_Version::has_fcfids() && VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11256
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11257
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11258
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11259
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11260
    moveL2D_reg(tmpD, src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11261
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11262
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11263
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11264
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11265
// Moved up as used in expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11266
//instruct convD2F_reg(regF dst, regD src) %{%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11267
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11268
// Convert to Double
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11269
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11270
// Integer to Double conversion.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11271
instruct convI2D_reg_Ex(regD dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11272
  match(Set dst (ConvI2D src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11273
  predicate(!VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11274
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11275
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11276
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11277
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11278
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11279
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11280
    convI2L_reg(tmpL, src);              // Sign-extension int to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11281
    regL_to_stkL(tmpS, tmpL);            // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11282
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11283
    convL2DRaw_regD(dst, tmpD);          // Convert to double.
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
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11287
// Integer to Double conversion. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11288
instruct convI2D_reg_mtfprd_Ex(regD dst, iRegIsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11289
  match(Set dst (ConvI2D src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11290
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11291
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11292
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11293
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11294
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11295
    moveI2D_reg(tmpD, src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11296
    convL2DRaw_regD(dst, tmpD);          // Convert to double.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11297
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11298
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11299
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11300
// Long to Double conversion
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11301
instruct convL2D_reg_Ex(regD dst, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11302
  match(Set dst (ConvL2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11303
  ins_cost(DEFAULT_COST + MEMORY_REF_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11306
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11307
    moveL2D_stack_reg(tmpD, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11308
    convL2DRaw_regD(dst, tmpD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11309
  %}
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
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11312
// Long to Double conversion. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11313
instruct convL2D_reg_mtfprd_Ex(regD dst, iRegLsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11314
  match(Set dst (ConvL2D src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11315
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11316
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11317
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11318
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11319
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11320
    moveL2D_reg(tmpD, src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11321
    convL2DRaw_regD(dst, tmpD);          // Convert to double.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11322
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11323
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11324
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11325
instruct convF2D_reg(regD dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11326
  match(Set dst (ConvF2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11327
  format %{ "FMR     $dst, $src \t// float->double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11328
  // variable size, 0 or 4
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11329
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11330
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11331
    __ fmr_if_needed($dst$$FloatRegister, $src$$FloatRegister);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11334
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11335
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11336
//----------Control Flow Instructions------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11337
// Compare Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11338
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11339
// Compare Integers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11340
instruct cmpI_reg_reg(flagsReg crx, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11341
  match(Set crx (CmpI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11342
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11343
  format %{ "CMPW    $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11344
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11345
    // TODO: PPC port $archOpcode(ppc64Opcode_cmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11346
    __ cmpw($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11347
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11348
  ins_pipe(pipe_class_compare);
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
instruct cmpI_reg_imm16(flagsReg crx, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11352
  match(Set crx (CmpI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11353
  format %{ "CMPWI   $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11354
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11355
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11356
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11357
    __ cmpwi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11358
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11359
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11360
%}
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
// (src1 & src2) == 0?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11363
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
 11364
  match(Set cr0 (CmpI (AndI src1 src2) zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11365
  // r0 is killed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11366
  format %{ "ANDI    R0, $src1, $src2 \t// BTST int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11367
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11368
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11369
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11370
    __ andi_(R0, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11371
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11372
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11373
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11374
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11375
instruct cmpL_reg_reg(flagsReg crx, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11376
  match(Set crx (CmpL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11377
  format %{ "CMPD    $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11378
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11379
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11380
    // TODO: PPC port $archOpcode(ppc64Opcode_cmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11381
    __ cmpd($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11382
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11383
  ins_pipe(pipe_class_compare);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11386
instruct cmpL_reg_imm16(flagsReg crx, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11387
  match(Set crx (CmpL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11388
  format %{ "CMPDI   $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11389
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11390
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11391
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11392
    __ cmpdi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11393
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11394
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11395
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11396
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11397
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
 11398
  match(Set cr0 (CmpL (AndL src1 src2) zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11399
  // r0 is killed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11400
  format %{ "AND     R0, $src1, $src2 \t// BTST long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11401
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11402
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11403
    // TODO: PPC port $archOpcode(ppc64Opcode_and_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11404
    __ and_(R0, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11405
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11406
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11407
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11408
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11409
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
 11410
  match(Set cr0 (CmpL (AndL src1 src2) zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11411
  // r0 is killed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11412
  format %{ "ANDI    R0, $src1, $src2 \t// BTST long" %}
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_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11416
    __ andi_(R0, $src1$$Register, $src2$$constant);
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_compare);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11421
instruct cmovI_conIvalueMinus1_conIvalue1(iRegIdst dst, flagsRegSrc crx) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11422
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11423
  effect(DEF dst, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11424
  predicate(false);
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
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11427
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11428
  format %{ "cmovI   $crx, $dst, -1, 0, +1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11429
  // Worst case is branch + move + branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11430
  size(false /* TODO: PPC PORTInsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 20 : 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11431
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11432
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11433
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11434
    // li(Rdst, 0);              // equal -> 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11435
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11436
    __ li($dst$$Register, 1);    // greater -> +1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11437
    __ bgt($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11438
    __ li($dst$$Register, -1);   // unordered or less -> -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11439
    // TODO: PPC port__ endgroup_if_needed(_size == 20);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11440
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11441
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11442
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11443
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11444
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11445
instruct cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(iRegIdst dst, flagsRegSrc crx) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11446
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11447
  effect(DEF dst, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11448
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11449
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11450
  format %{ "CmovI    $crx, $dst, -1, 0, +1 \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11451
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11452
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11453
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11454
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11455
    //   region  crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11456
    //    \       |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11457
    //     dst=cmovI_conIvalueMinus1_conIvalue0_conIvalue1
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
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11460
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11461
    //   region
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11462
    //    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11463
    //     dst=loadConI16(0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11464
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11465
    //      ^  region  crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11466
    //      |   \       |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11467
    //      dst=cmovI_conIvalueMinus1_conIvalue1
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11470
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11471
    MachNode *m1 = new loadConI16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11472
    MachNode *m2 = new cmovI_conIvalueMinus1_conIvalue1Node();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11473
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11474
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11475
    m1->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11476
    m2->add_req(n_region, n_crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11477
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11478
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11479
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11480
    m1->_opnds[0] = op_dst;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11481
    m1->_opnds[1] = new immI16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11482
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11483
    m2->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11484
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11485
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11486
    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
 11487
    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
 11488
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11489
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11490
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11491
    nodes->push(m2);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11495
// Manifest a CmpL3 result in an integer register. Very painful.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11496
// This is the test to avoid.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11497
// (src1 < src2) ? -1 : ((src1 > src2) ? 1 : 0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11498
instruct cmpL3_reg_reg_ExEx(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11499
  match(Set dst (CmpL3 src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11500
  ins_cost(DEFAULT_COST*5+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11501
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11502
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11503
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11504
    cmpL_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11505
    cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(dst, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11506
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11507
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11508
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11509
// Implicit range checks.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11510
// 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
 11511
//  - (If le (CmpU length index)), (IfTrue  throw exception)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11512
//  - (If lt (CmpU index length)), (IfFalse throw exception)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11513
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11514
// Match range check 'If le (CmpU length index)'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11515
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
 11516
  match(If cmp (CmpU src_length index));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11517
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11518
  predicate(TrapBasedRangeChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11519
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::le &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11520
            PROB_UNLIKELY(_leaf->as_If()->_prob) >= PROB_ALWAYS &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11521
            (Matcher::branches_to_uncommon_trap(_leaf)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11522
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11523
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11524
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11525
  format %{ "TWI     $index $cmp $src_length \t// RangeCheck => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11526
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11527
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11528
    // TODO: PPC port $archOpcode(ppc64Opcode_twi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11529
    if ($cmp$$cmpcode == 0x1 /* less_equal */) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11530
      __ trap_range_check_le($src_length$$Register, $index$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11531
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11532
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11533
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11534
      assert($cmp$$cmpcode == 0x9, "must be greater");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11535
      __ trap_range_check_g($src_length$$Register, $index$$constant);
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
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11538
  ins_pipe(pipe_class_trap);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11541
// Match range check 'If lt (CmpU index length)'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11542
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
 11543
  match(If cmp (CmpU src_index src_length));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11544
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11545
  predicate(TrapBasedRangeChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11546
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::lt &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11547
            _leaf->as_If()->_prob >= PROB_ALWAYS &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11548
            (Matcher::branches_to_uncommon_trap(_leaf)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11549
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11550
  ins_is_TrapBasedCheckNode(true);
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
  format %{ "TW      $src_index $cmp $src_length \t// RangeCheck => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11553
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11554
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11555
    // TODO: PPC port $archOpcode(ppc64Opcode_tw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11556
    if ($cmp$$cmpcode == 0x0 /* greater_equal */) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11557
      __ trap_range_check_ge($src_index$$Register, $src_length$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11558
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11559
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11560
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11561
      assert($cmp$$cmpcode == 0x8, "must be less");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11562
      __ trap_range_check_l($src_index$$Register, $src_length$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11563
    }
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
  ins_pipe(pipe_class_trap);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11568
// Match range check 'If lt (CmpU index length)'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11569
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
 11570
  match(If cmp (CmpU src_index length));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11571
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11572
  predicate(TrapBasedRangeChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11573
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::lt &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11574
            _leaf->as_If()->_prob >= PROB_ALWAYS &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11575
            (Matcher::branches_to_uncommon_trap(_leaf)));
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
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11578
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11579
  format %{ "TWI     $src_index $cmp $length \t// RangeCheck => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11580
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11581
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11582
    // TODO: PPC port $archOpcode(ppc64Opcode_twi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11583
    if ($cmp$$cmpcode == 0x0 /* greater_equal */) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11584
      __ trap_range_check_ge($src_index$$Register, $length$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11585
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11586
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11587
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11588
      assert($cmp$$cmpcode == 0x8, "must be less");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11589
      __ trap_range_check_l($src_index$$Register, $length$$constant);
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
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11592
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11593
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11594
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11595
instruct compU_reg_reg(flagsReg crx, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11596
  match(Set crx (CmpU src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11597
  format %{ "CMPLW   $crx, $src1, $src2 \t// unsigned" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11598
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11599
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11600
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11601
    __ cmplw($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11602
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11603
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11604
%}
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
instruct compU_reg_uimm16(flagsReg crx, iRegIsrc src1, uimmI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11607
  match(Set crx (CmpU src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11608
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11609
  format %{ "CMPLWI  $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11610
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11611
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11612
    __ cmplwi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11613
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11614
  ins_pipe(pipe_class_compare);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11617
// Implicit zero checks (more implicit null checks).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11618
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11619
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
 11620
  match(If cmp (CmpN value zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11621
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11622
  predicate(TrapBasedNullChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11623
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ne &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11624
            _leaf->as_If()->_prob >= PROB_LIKELY_MAG(4) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11625
            Matcher::branches_to_uncommon_trap(_leaf));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11626
  ins_cost(1);
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
  ins_is_TrapBasedCheckNode(true);
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
  format %{ "TDI     $value $cmp $zero \t// ZeroCheckN => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11631
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11632
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11633
    // TODO: PPC port $archOpcode(ppc64Opcode_tdi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11634
    if ($cmp$$cmpcode == 0xA) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11635
      __ trap_null_check($value$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11636
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11637
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11638
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11639
      assert($cmp$$cmpcode == 0x2 , "must be equal(0xA) or notEqual(0x2)");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11640
      __ trap_null_check($value$$Register, Assembler::traptoGreaterThanUnsigned);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11641
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11642
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11643
  ins_pipe(pipe_class_trap);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11646
// Compare narrow oops.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11647
instruct cmpN_reg_reg(flagsReg crx, iRegNsrc src1, iRegNsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11648
  match(Set crx (CmpN src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11649
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11650
  size(4);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
 11651
  ins_cost(2);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11652
  format %{ "CMPLW   $crx, $src1, $src2 \t// compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11653
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11654
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11655
    __ cmplw($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11656
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11657
  ins_pipe(pipe_class_compare);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11660
instruct cmpN_reg_imm0(flagsReg crx, iRegNsrc src1, immN_0 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11661
  match(Set crx (CmpN src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11662
  // Make this more expensive than zeroCheckN_iReg_imm0.
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
 11663
  ins_cost(2);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11664
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11665
  format %{ "CMPLWI  $crx, $src1, $src2 \t// compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11666
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11667
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11668
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11669
    __ cmplwi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11670
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11671
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11672
%}
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
// Implicit zero checks (more implicit null checks).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11675
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11676
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
 11677
  match(If cmp (CmpP value zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11678
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11679
  predicate(TrapBasedNullChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11680
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ne &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11681
            _leaf->as_If()->_prob >= PROB_LIKELY_MAG(4) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11682
            Matcher::branches_to_uncommon_trap(_leaf));
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
 11683
  ins_cost(1); // Should not be cheaper than zeroCheckN.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11684
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11685
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11686
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11687
  format %{ "TDI     $value $cmp $zero \t// ZeroCheckP => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11688
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11689
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11690
    // TODO: PPC port $archOpcode(ppc64Opcode_tdi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11691
    if ($cmp$$cmpcode == 0xA) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11692
      __ trap_null_check($value$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11693
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11694
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11695
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11696
      assert($cmp$$cmpcode == 0x2 , "must be equal(0xA) or notEqual(0x2)");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11697
      __ trap_null_check($value$$Register, Assembler::traptoGreaterThanUnsigned);
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
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11700
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11701
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11702
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11703
// Compare Pointers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11704
instruct cmpP_reg_reg(flagsReg crx, iRegP_N2P src1, iRegP_N2P src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11705
  match(Set crx (CmpP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11706
  format %{ "CMPLD   $crx, $src1, $src2 \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11707
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11708
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11709
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11710
    __ cmpld($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11711
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11712
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11713
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11714
42072
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11715
instruct cmpP_reg_null(flagsReg crx, iRegP_N2P src1, immP_0or1 src2) %{
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11716
  match(Set crx (CmpP src1 src2));
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11717
  format %{ "CMPLDI   $crx, $src1, $src2 \t// ptr" %}
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11718
  size(4);
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11719
  ins_encode %{
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11720
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11721
    __ cmpldi($crx$$CondRegister, $src1$$Register, (int)((short)($src2$$constant & 0xFFFF)));
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11722
  %}
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11723
  ins_pipe(pipe_class_compare);
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11724
%}
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 11725
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11726
// Used in postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11727
instruct cmpP_reg_imm16(flagsReg crx, iRegPsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11728
  // This match rule prevents reordering of node before a safepoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11729
  // This only makes sense if this instructions is used exclusively
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11730
  // for the expansion of EncodeP!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11731
  match(Set crx (CmpP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11732
  predicate(false);
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
  format %{ "CMPDI   $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11735
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11736
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11737
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11738
    __ cmpdi($crx$$CondRegister, $src1$$Register, $src2$$constant);
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
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11741
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11742
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11743
//----------Float Compares----------------------------------------------------
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
instruct cmpFUnordered_reg_reg(flagsReg crx, regF src1, regF src2) %{
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11746
  // Needs matchrule, see cmpDUnordered.
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
 11747
  match(Set crx (CmpF src1 src2));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11748
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11749
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11750
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11751
  format %{ "cmpFUrd $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11752
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11753
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11754
    // TODO: PPC port $archOpcode(ppc64Opcode_fcmpu);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11755
    __ fcmpu($crx$$CondRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11756
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11757
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11758
%}
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
instruct cmov_bns_less(flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11761
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11762
  effect(DEF crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11763
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11764
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11765
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11766
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11767
  format %{ "cmov    $crx" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11768
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11769
  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
 11770
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11771
    // TODO: PPC port $archOpcode(ppc64Opcode_cmovecr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11772
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11773
    __ bns($crx$$CondRegister, done);        // not unordered -> keep crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11774
    __ li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11775
    __ cmpwi($crx$$CondRegister, R0, 1);     // unordered -> set crx to 'less'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11776
    // TODO PPC port __ endgroup_if_needed(_size == 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11777
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11778
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11779
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11780
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11781
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11782
// Compare floating, generate condition code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11783
instruct cmpF_reg_reg_Ex(flagsReg crx, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11784
  // FIXME: should we match 'If cmp (CmpF src1 src2))' ??
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11785
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11786
  // The following code sequence occurs a lot in mpegaudio:
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
  // block BXX:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11789
  // 0: instruct cmpFUnordered_reg_reg (cmpF_reg_reg-0):
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11790
  //    cmpFUrd CCR6, F11, F9
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11791
  // 4: instruct cmov_bns_less (cmpF_reg_reg-1):
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11792
  //    cmov CCR6
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11793
  // 8: instruct branchConSched:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11794
  //    B_FARle CCR6, B56  P=0.500000 C=-1.000000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11795
  match(Set crx (CmpF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11796
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11797
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11798
  format %{ "CmpF    $crx, $src1, $src2 \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11799
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11800
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11801
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11802
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11803
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11804
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11805
    //     crx=cmpF_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11806
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11807
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11808
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11809
    //   region  src1  src2
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
    //     crx=cmpFUnordered_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11812
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11813
    //      ^  region
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11814
    //      |   \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11815
    //      crx=cmov_bns_less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11816
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11817
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11818
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11819
    MachNode *m1 = new cmpFUnordered_reg_regNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11820
    MachNode *m2 = new cmov_bns_lessNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11821
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11822
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11823
    m1->add_req(n_region, n_src1, n_src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11824
    m2->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11825
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11826
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11827
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11828
    m1->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11829
    m1->_opnds[1] = op_src1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11830
    m1->_opnds[2] = op_src2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11831
    m2->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11832
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11833
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11834
    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
 11835
    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
 11836
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11837
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11838
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11839
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11840
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11841
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11842
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11843
// Compare float, generate -1,0,1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11844
instruct cmpF3_reg_reg_ExEx(iRegIdst dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11845
  match(Set dst (CmpF3 src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11846
  ins_cost(DEFAULT_COST*5+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11847
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11848
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11849
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11850
    cmpFUnordered_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11851
    cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(dst, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11852
  %}
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11855
instruct cmpDUnordered_reg_reg(flagsReg crx, regD src1, regD src2) %{
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
 11856
  // Needs matchrule so that ideal opcode is Cmp. This causes that gcm places the
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
 11857
  // node right before the conditional move using it.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11858
  // In jck test api/java_awt/geom/QuadCurve2DFloat/index.html#SetCurveTesttestCase7,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11859
  // compilation of java.awt.geom.RectangularShape::getBounds()Ljava/awt/Rectangle
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11860
  // crashed in register allocation where the flags Reg between cmpDUnoredered and a
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11861
  // conditional move was supposed to be spilled.
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
 11862
  match(Set crx (CmpD src1 src2));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11863
  // False predicate, shall not be matched.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11864
  predicate(false);
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 %{ "cmpFUrd $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11867
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11868
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11869
    // TODO: PPC port $archOpcode(ppc64Opcode_fcmpu);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11870
    __ fcmpu($crx$$CondRegister, $src1$$FloatRegister, $src2$$FloatRegister);
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_default);
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
instruct cmpD_reg_reg_Ex(flagsReg crx, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11876
  match(Set crx (CmpD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11877
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11878
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11879
  format %{ "CmpD    $crx, $src1, $src2 \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11880
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11881
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11882
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11883
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11884
    //   region  src1  src2
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
    //     crx=cmpD_reg_reg
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
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11889
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11890
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11891
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11892
    //     crx=cmpDUnordered_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11893
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11894
    //      ^  region
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11895
    //      |   \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11896
    //      crx=cmov_bns_less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11897
    //
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
    // create new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11900
    MachNode *m1 = new cmpDUnordered_reg_regNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11901
    MachNode *m2 = new cmov_bns_lessNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11902
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11903
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11904
    m1->add_req(n_region, n_src1, n_src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11905
    m2->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11906
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11907
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11908
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11909
    m1->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11910
    m1->_opnds[1] = op_src1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11911
    m1->_opnds[2] = op_src2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11912
    m2->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11913
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11914
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11915
    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
 11916
    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
 11917
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11918
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11919
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11920
    nodes->push(m2);
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
%}
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
// Compare double, generate -1,0,1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11925
instruct cmpD3_reg_reg_ExEx(iRegIdst dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11926
  match(Set dst (CmpD3 src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11927
  ins_cost(DEFAULT_COST*5+BRANCH_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11930
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11931
    cmpDUnordered_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11932
    cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(dst, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11933
  %}
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11936
//----------Branches---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11937
// Jump
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11938
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11939
// Direct Branch.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11940
instruct branch(label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11941
  match(Goto);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11942
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11943
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11944
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11945
  format %{ "B       $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11946
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11947
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11948
    // TODO: PPC port $archOpcode(ppc64Opcode_b);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11949
     Label d;    // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11950
     __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11951
     Label* p = $labl$$label;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11952
     // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11953
     // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11954
     Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11955
     __ b(l);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11958
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11959
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11960
// Conditional Near Branch
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11961
instruct branchCon(cmpOp cmp, flagsRegSrc crx, label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11962
  // Same match rule as `branchConFar'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11963
  match(If cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11964
  effect(USE lbl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11965
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11966
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11967
  // If set to 1 this indicates that the current instruction is a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11968
  // short variant of a long branch. This avoids using this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11969
  // instruction in first-pass matching. It will then only be used in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11970
  // the `Shorten_branches' pass.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11971
  ins_short_branch(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11972
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11973
  format %{ "B$cmp     $crx, $lbl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11974
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11975
  ins_encode( enc_bc(crx, cmp, lbl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11976
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11979
// This is for cases when the ppc64 `bc' instruction does not
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11980
// 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
 11981
// expensive.
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
// Conditional Far Branch
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11984
instruct branchConFar(cmpOp cmp, flagsRegSrc crx, label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11985
  // Same match rule as `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11986
  match(If cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11987
  effect(USE crx, USE lbl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11988
  predicate(!false /* TODO: PPC port HB_Schedule*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11989
  // Higher cost than `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11990
  ins_cost(5*BRANCH_COST);
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
  // 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
 11993
  ins_short_branch(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
  format %{ "B_FAR$cmp $crx, $lbl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11996
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11997
  ins_encode( enc_bc_far(crx, cmp, lbl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11998
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11999
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12001
// Conditional Branch used with Power6 scheduler (can be far or short).
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12002
instruct branchConSched(cmpOp cmp, flagsRegSrc crx, label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12003
  // Same match rule as `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12004
  match(If cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12005
  effect(USE crx, USE lbl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12006
  predicate(false /* TODO: PPC port HB_Schedule*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12007
  // Higher cost than `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12008
  ins_cost(5*BRANCH_COST);
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
  // Actually size doesn't depend on alignment but on shortening.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12011
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12012
  // long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12013
  ins_short_branch(0);
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
  format %{ "B_FAR$cmp $crx, $lbl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12016
  size(8); // worst case
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12017
  ins_encode( enc_bc_short_far(crx, cmp, lbl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12018
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12019
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12020
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12021
instruct branchLoopEnd(cmpOp cmp, flagsRegSrc crx, label labl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12022
  match(CountedLoopEnd cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12023
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12024
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12025
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12026
  // short variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12027
  ins_short_branch(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12028
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12029
  format %{ "B$cmp     $crx, $labl \t// counted loop end" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12030
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12031
  ins_encode( enc_bc(crx, cmp, labl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12032
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12033
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12034
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12035
instruct branchLoopEndFar(cmpOp cmp, flagsRegSrc crx, label labl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12036
  match(CountedLoopEnd cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12037
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12038
  predicate(!false /* TODO: PPC port HB_Schedule */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12039
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12040
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12041
  // Long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12042
  ins_short_branch(0);
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
  format %{ "B_FAR$cmp $crx, $labl \t// counted loop end" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12045
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12046
  ins_encode( enc_bc_far(crx, cmp, labl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12047
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12050
// Conditional Branch used with Power6 scheduler (can be far or short).
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12051
instruct branchLoopEndSched(cmpOp cmp, flagsRegSrc crx, label labl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12052
  match(CountedLoopEnd cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12053
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12054
  predicate(false /* TODO: PPC port HB_Schedule */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12055
  // Higher cost than `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12056
  ins_cost(5*BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12057
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12058
  // Actually size doesn't depend on alignment but on shortening.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12059
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12060
  // Long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12061
  ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12062
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12063
  format %{ "B_FAR$cmp $crx, $labl \t// counted loop end" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12064
  size(8); // worst case
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12065
  ins_encode( enc_bc_short_far(crx, cmp, labl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12066
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12067
%}
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
// Java runtime operations, intrinsics and other complex operations.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12071
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12072
// 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
 12073
// 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
 12074
// hit (cache is checked with exposed code in gen_subtype_check()). Return
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12075
// 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
 12076
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12077
// GL TODO: Improve this.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12078
// - result should not be a TEMP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12079
// - Add match rule as on sparc avoiding additional Cmp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12080
instruct partialSubtypeCheck(iRegPdst result, iRegP_N2P subklass, iRegP_N2P superklass,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12081
                             iRegPdst tmp_klass, iRegPdst tmp_arrayptr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12082
  match(Set result (PartialSubtypeCheck subklass superklass));
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
 12083
  effect(TEMP_DEF result, TEMP tmp_klass, TEMP tmp_arrayptr);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12084
  ins_cost(DEFAULT_COST*10);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12085
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12086
  format %{ "PartialSubtypeCheck $result = ($subklass instanceOf $superklass) tmp: $tmp_klass, $tmp_arrayptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12087
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12088
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12089
    __ 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
 12090
                                     $tmp_klass$$Register, NULL, $result$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12093
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12094
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12095
// inlined locking and unlocking
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12096
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12097
instruct cmpFastLock(flagsReg crx, iRegPdst oop, iRegPdst box, iRegPdst tmp1, iRegPdst tmp2) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12098
  match(Set crx (FastLock oop box));
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12099
  effect(TEMP tmp1, TEMP tmp2);
31773
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30758
diff changeset
 12100
  predicate(!Compile::current()->use_rtm());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12101
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12102
  format %{ "FASTLOCK  $oop, $box, $tmp1, $tmp2" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12103
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12104
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12105
    __ compiler_fast_lock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12106
                                 $tmp1$$Register, $tmp2$$Register, /*tmp3*/ R0,
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 33065
diff changeset
 12107
                                 UseBiasedLocking && !UseOptoBiasInlining);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12108
    // If locking was successfull, crx should indicate 'EQ'.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12109
    // The compiler generates a branch to the runtime call to
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12110
    // _complete_monitor_locking_Java for the case where crx is 'NE'.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12111
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12112
  ins_pipe(pipe_class_compare);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12113
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12114
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12115
// Separate version for TM. Use bound register for box to enable USE_KILL.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12116
instruct cmpFastLock_tm(flagsReg crx, iRegPdst oop, rarg2RegP box, iRegPdst tmp1, iRegPdst tmp2, iRegPdst tmp3) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12117
  match(Set crx (FastLock oop box));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12118
  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, USE_KILL box);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12119
  predicate(Compile::current()->use_rtm());
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12120
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12121
  format %{ "FASTLOCK  $oop, $box, $tmp1, $tmp2, $tmp3 (TM)" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12122
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12123
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12124
    __ compiler_fast_lock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12125
                                 $tmp1$$Register, $tmp2$$Register, $tmp3$$Register,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12126
                                 /*Biased Locking*/ false,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12127
                                 _rtm_counters, _stack_rtm_counters,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12128
                                 ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12129
                                 /*TM*/ true, ra_->C->profile_rtm());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12130
    // If locking was successfull, crx should indicate 'EQ'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12131
    // The compiler generates a branch to the runtime call to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12132
    // _complete_monitor_locking_Java for the case where crx is 'NE'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12133
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12134
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12135
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12136
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12137
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
 12138
  match(Set crx (FastUnlock oop box));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12139
  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12140
  predicate(!Compile::current()->use_rtm());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12141
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12142
  format %{ "FASTUNLOCK  $oop, $box, $tmp1, $tmp2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12143
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12144
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12145
    __ compiler_fast_unlock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12146
                                   $tmp1$$Register, $tmp2$$Register, $tmp3$$Register,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12147
                                   UseBiasedLocking && !UseOptoBiasInlining,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12148
                                   false);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12149
    // If unlocking was successfull, crx should indicate 'EQ'.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12150
    // The compiler generates a branch to the runtime call to
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12151
    // _complete_monitor_unlocking_Java for the case where crx is 'NE'.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12152
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12153
  ins_pipe(pipe_class_compare);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12154
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12155
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12156
instruct cmpFastUnlock_tm(flagsReg crx, iRegPdst oop, iRegPdst box, iRegPdst tmp1, iRegPdst tmp2, iRegPdst tmp3) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12157
  match(Set crx (FastUnlock oop box));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12158
  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12159
  predicate(Compile::current()->use_rtm());
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12160
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12161
  format %{ "FASTUNLOCK  $oop, $box, $tmp1, $tmp2 (TM)" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12162
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12163
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12164
    __ compiler_fast_unlock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12165
                                   $tmp1$$Register, $tmp2$$Register, $tmp3$$Register,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12166
                                   /*Biased Locking*/ false, /*TM*/ true);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12167
    // If unlocking was successfull, crx should indicate 'EQ'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12168
    // The compiler generates a branch to the runtime call to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12169
    // _complete_monitor_unlocking_Java for the case where crx is 'NE'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12170
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12171
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12172
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12173
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12174
// Align address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12175
instruct align_addr(iRegPdst dst, iRegPsrc src, immLnegpow2 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12176
  match(Set dst (CastX2P (AndL (CastP2X src) mask)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12177
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12178
  format %{ "ANDDI   $dst, $src, $mask \t// next aligned address" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12179
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12180
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12181
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12182
    __ clrrdi($dst$$Register, $src$$Register, log2_long((jlong)-$mask$$constant));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12183
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12184
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12185
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12186
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12187
// Array size computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12188
instruct array_size(iRegLdst dst, iRegPsrc end, iRegPsrc start) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12189
  match(Set dst (SubL (CastP2X end) (CastP2X start)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12190
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12191
  format %{ "SUB     $dst, $end, $start \t// array size in bytes" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12192
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12193
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12194
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12195
    __ subf($dst$$Register, $start$$Register, $end$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12196
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12197
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12198
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12199
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12200
// Clear-array with constant short array length. The versions below can use dcbz with cnt > 30.
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12201
instruct inlineCallClearArrayShort(immLmax30 cnt, rarg2RegP base, Universe dummy, regCTR ctr) %{
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12202
  match(Set dummy (ClearArray cnt base));
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12203
  effect(USE_KILL base, KILL ctr);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12204
  ins_cost(2 * MEMORY_REF_COST);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12205
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12206
  format %{ "ClearArray $cnt, $base" %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12207
  ins_encode %{
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12208
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12209
    __ clear_memory_constlen($base$$Register, $cnt$$constant, R0); // kills base, R0
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12210
  %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12211
  ins_pipe(pipe_class_default);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12212
%}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12213
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12214
// Clear-array with constant large array length.
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12215
instruct inlineCallClearArrayLarge(immL cnt, rarg2RegP base, Universe dummy, iRegLdst tmp, regCTR ctr) %{
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12216
  match(Set dummy (ClearArray cnt base));
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12217
  effect(USE_KILL base, TEMP tmp, KILL ctr);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12218
  ins_cost(3 * MEMORY_REF_COST);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12219
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12220
  format %{ "ClearArray $cnt, $base \t// KILL $tmp" %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12221
  ins_encode %{
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12222
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12223
    __ clear_memory_doubleword($base$$Register, $tmp$$Register, R0, $cnt$$constant); // kills base, R0
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12224
  %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12225
  ins_pipe(pipe_class_default);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12226
%}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12227
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12228
// Clear-array with dynamic array length.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12229
instruct inlineCallClearArray(rarg1RegL cnt, rarg2RegP base, Universe dummy, regCTR ctr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12230
  match(Set dummy (ClearArray cnt base));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12231
  effect(USE_KILL cnt, USE_KILL base, KILL ctr);
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12232
  ins_cost(4 * MEMORY_REF_COST);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12233
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12234
  format %{ "ClearArray $cnt, $base" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12235
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12236
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12237
    __ clear_memory_doubleword($base$$Register, $cnt$$Register, R0); // kills cnt, base, R0
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12238
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12239
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12240
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12241
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12242
instruct string_compareL(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12243
                         iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12244
  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12245
  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12246
  effect(TEMP_DEF result, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL ctr, KILL cr0, TEMP tmp);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12247
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12248
  format %{ "String Compare byte[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12249
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12250
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12251
    __ string_compare($str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12252
                      $cnt1$$Register, $cnt2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12253
                      $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12254
                      $result$$Register, StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12255
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12256
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12257
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12258
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12259
instruct string_compareU(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12260
                         iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12261
  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12262
  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12263
  effect(TEMP_DEF result, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL ctr, KILL cr0, TEMP tmp);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12264
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12265
  format %{ "String Compare char[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12266
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12267
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12268
    __ string_compare($str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12269
                      $cnt1$$Register, $cnt2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12270
                      $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12271
                      $result$$Register, StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12272
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12273
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12274
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12275
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12276
instruct string_compareLU(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12277
                          iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12278
  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12279
  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12280
  effect(TEMP_DEF result, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL ctr, KILL cr0, TEMP tmp);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12281
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12282
  format %{ "String Compare byte[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12283
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12284
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12285
    __ string_compare($str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12286
                      $cnt1$$Register, $cnt2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12287
                      $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12288
                      $result$$Register, StrIntrinsicNode::LU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12289
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12290
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12291
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12292
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12293
instruct string_compareUL(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12294
                          iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12295
  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12296
  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12297
  effect(TEMP_DEF result, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL ctr, KILL cr0, TEMP tmp);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12298
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12299
  format %{ "String Compare byte[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12300
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12301
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12302
    __ string_compare($str2$$Register, $str1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12303
                      $cnt2$$Register, $cnt1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12304
                      $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12305
                      $result$$Register, StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12306
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12307
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12308
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12309
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12310
instruct string_equalsL(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12311
                        iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12312
  predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12313
  match(Set result (StrEquals (Binary str1 str2) cnt));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12314
  effect(TEMP_DEF result, USE_KILL str1, USE_KILL str2, USE_KILL cnt, TEMP tmp, KILL ctr, KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12315
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12316
  format %{ "String Equals byte[] $str1,$str2,$cnt -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12317
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12318
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12319
    __ array_equals(false, $str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12320
                    $cnt$$Register, $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12321
                    $result$$Register, true /* byte */);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12322
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12323
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12324
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12325
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12326
instruct string_equalsU(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12327
                        iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12328
  predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12329
  match(Set result (StrEquals (Binary str1 str2) cnt));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12330
  effect(TEMP_DEF result, USE_KILL str1, USE_KILL str2, USE_KILL cnt, TEMP tmp, KILL ctr, KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12331
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12332
  format %{ "String Equals char[]  $str1,$str2,$cnt -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12333
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12334
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12335
    __ array_equals(false, $str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12336
                    $cnt$$Register, $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12337
                    $result$$Register, false /* byte */);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12338
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12339
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12340
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12341
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12342
instruct array_equalsB(rarg1RegP ary1, rarg2RegP ary2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12343
                       iRegIdst tmp1, iRegIdst tmp2, regCTR ctr, flagsRegCR0 cr0, flagsRegCR0 cr1) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12344
  predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12345
  match(Set result (AryEq ary1 ary2));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12346
  effect(TEMP_DEF result, USE_KILL ary1, USE_KILL ary2, TEMP tmp1, TEMP tmp2, KILL ctr, KILL cr0, KILL cr1);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12347
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12348
  format %{ "Array Equals $ary1,$ary2 -> $result \t// KILL $tmp1,$tmp2" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12349
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12350
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12351
    __ array_equals(true, $ary1$$Register, $ary2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12352
                    $tmp1$$Register, $tmp2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12353
                    $result$$Register, true /* byte */);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12354
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12355
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12356
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12357
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12358
instruct array_equalsC(rarg1RegP ary1, rarg2RegP ary2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12359
                       iRegIdst tmp1, iRegIdst tmp2, regCTR ctr, flagsRegCR0 cr0, flagsRegCR0 cr1) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12360
  predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12361
  match(Set result (AryEq ary1 ary2));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12362
  effect(TEMP_DEF result, USE_KILL ary1, USE_KILL ary2, TEMP tmp1, TEMP tmp2, KILL ctr, KILL cr0, KILL cr1);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12363
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12364
  format %{ "Array Equals $ary1,$ary2 -> $result \t// KILL $tmp1,$tmp2" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12365
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12366
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12367
    __ array_equals(true, $ary1$$Register, $ary2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12368
                    $tmp1$$Register, $tmp2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12369
                    $result$$Register, false /* byte */);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12370
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12371
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12372
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12373
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12374
instruct indexOf_imm1_char_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12375
                             immP needleImm, immL offsetImm, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12376
                             iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12377
                             flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12378
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary (AddP needleImm offsetImm) needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12379
  effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12380
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12381
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12382
  ins_cost(150);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12383
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12384
  format %{ "String IndexOf CSCL1 $haystack[0..$haycnt], $needleImm+$offsetImm[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12385
            "-> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12386
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12387
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12388
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12389
    immPOper *needleOper = (immPOper *)$needleImm;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12390
    const TypeOopPtr *t = needleOper->type()->isa_oopptr();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12391
    ciTypeArray* needle_values = t->const_oop()->as_type_array();  // Pointer to live char *
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12392
    jchar chr;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12393
#ifdef VM_LITTLE_ENDIAN
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12394
    chr = (((jchar)(unsigned char)needle_values->element_value(1).as_byte()) << 8) |
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12395
           ((jchar)(unsigned char)needle_values->element_value(0).as_byte());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12396
#else
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12397
    chr = (((jchar)(unsigned char)needle_values->element_value(0).as_byte()) << 8) |
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12398
           ((jchar)(unsigned char)needle_values->element_value(1).as_byte());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12399
#endif
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12400
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12401
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12402
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12403
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12404
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12405
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12406
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12407
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12408
instruct indexOf_imm1_char_L(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12409
                             immP needleImm, immL offsetImm, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12410
                             iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12411
                             flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12412
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary (AddP needleImm offsetImm) needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12413
  effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12414
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12415
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12416
  ins_cost(150);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12417
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12418
  format %{ "String IndexOf CSCL1 $haystack[0..$haycnt], $needleImm+$offsetImm[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12419
            "-> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12420
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12421
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12422
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12423
    immPOper *needleOper = (immPOper *)$needleImm;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12424
    const TypeOopPtr *t = needleOper->type()->isa_oopptr();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12425
    ciTypeArray* needle_values = t->const_oop()->as_type_array();  // Pointer to live char *
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12426
    jchar chr = (jchar)needle_values->element_value(0).as_byte();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12427
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12428
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12429
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12430
                           $tmp1$$Register, $tmp2$$Register, true /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12431
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12432
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12433
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12434
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12435
instruct indexOf_imm1_char_UL(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12436
                              immP needleImm, immL offsetImm, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12437
                              iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12438
                              flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12439
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary (AddP needleImm offsetImm) needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12440
  effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12441
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12442
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12443
  ins_cost(150);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12444
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12445
  format %{ "String IndexOf CSCL1 $haystack[0..$haycnt], $needleImm+$offsetImm[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12446
            "-> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12447
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12448
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12449
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12450
    immPOper *needleOper = (immPOper *)$needleImm;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12451
    const TypeOopPtr *t = needleOper->type()->isa_oopptr();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12452
    ciTypeArray* needle_values = t->const_oop()->as_type_array();  // Pointer to live char *
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12453
    jchar chr = (jchar)needle_values->element_value(0).as_byte();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12454
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12455
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12456
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12457
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12458
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12459
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12460
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12461
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12462
instruct indexOf_imm1_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12463
                        rscratch2RegP needle, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12464
                        iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12465
                        flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12466
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12467
  effect(USE_KILL needle, TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12468
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12469
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12470
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12471
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12472
  ins_cost(180);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12473
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12474
  format %{ "String IndexOf SCL1 $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12475
            " -> $result \t// KILL $haycnt, $needle, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12476
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12477
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12478
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12479
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12480
    guarantee(needle_values, "sanity");
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12481
    jchar chr;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12482
#ifdef VM_LITTLE_ENDIAN
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12483
    chr = (((jchar)(unsigned char)needle_values->element_value(1).as_byte()) << 8) |
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12484
           ((jchar)(unsigned char)needle_values->element_value(0).as_byte());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12485
#else
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12486
    chr = (((jchar)(unsigned char)needle_values->element_value(0).as_byte()) << 8) |
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12487
           ((jchar)(unsigned char)needle_values->element_value(1).as_byte());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12488
#endif
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12489
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12490
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12491
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12492
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12493
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12494
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12495
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12496
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12497
instruct indexOf_imm1_L(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12498
                        rscratch2RegP needle, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12499
                        iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12500
                        flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12501
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12502
  effect(USE_KILL needle, TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12503
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12504
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12505
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12506
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12507
  ins_cost(180);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12508
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12509
  format %{ "String IndexOf SCL1 $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12510
            " -> $result \t// KILL $haycnt, $needle, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12511
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12512
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12513
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12514
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12515
    guarantee(needle_values, "sanity");
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12516
    jchar chr = (jchar)needle_values->element_value(0).as_byte();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12517
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12518
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12519
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12520
                           $tmp1$$Register, $tmp2$$Register, true /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12521
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12522
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12523
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12524
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12525
instruct indexOf_imm1_UL(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12526
                         rscratch2RegP needle, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12527
                         iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12528
                         flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12529
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12530
  effect(USE_KILL needle, TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12531
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12532
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12533
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12534
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12535
  ins_cost(180);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12536
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12537
  format %{ "String IndexOf SCL1 $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12538
            " -> $result \t// KILL $haycnt, $needle, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12539
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12540
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12541
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12542
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12543
    guarantee(needle_values, "sanity");
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12544
    jchar chr = (jchar)needle_values->element_value(0).as_byte();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12545
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12546
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12547
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12548
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12549
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12550
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12551
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12552
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12553
instruct indexOfChar_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12554
                       iRegIsrc ch, iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12555
                       flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12556
  match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12557
  effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12558
  ins_cost(180);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12559
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12560
  format %{ "String IndexOfChar $haystack[0..$haycnt], $ch"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12561
            " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12562
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12563
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12564
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12565
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12566
                           $ch$$Register, 0 /* this is not used if the character is already in a register */,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12567
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12568
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12569
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12570
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12571
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12572
instruct indexOf_imm_U(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12573
                       iRegPsrc needle, uimmI15 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12574
                       iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12575
                       flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12576
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12577
  effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12578
         TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, KILL cr0, KILL cr1, KILL cr6, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12579
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12580
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12581
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12582
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12583
  ins_cost(250);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12584
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12585
  format %{ "String IndexOf SCL $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12586
            " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12587
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12588
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12589
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12590
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12591
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12592
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12593
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12594
                      $needle$$Register, needle_values, $tmp5$$Register, $needlecntImm$$constant,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12595
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12596
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12597
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12598
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12599
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12600
instruct indexOf_imm_L(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12601
                       iRegPsrc needle, uimmI15 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12602
                       iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12603
                       flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12604
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12605
  effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12606
         TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, KILL cr0, KILL cr1, KILL cr6, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12607
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12608
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12609
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12610
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12611
  ins_cost(250);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12612
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12613
  format %{ "String IndexOf SCL $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12614
            " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12615
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12616
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12617
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12618
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12619
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12620
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12621
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12622
                      $needle$$Register, needle_values, $tmp5$$Register, $needlecntImm$$constant,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12623
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12624
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12625
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12626
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12627
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12628
instruct indexOf_imm_UL(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12629
                        iRegPsrc needle, uimmI15 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12630
                        iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12631
                        flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12632
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12633
  effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12634
         TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, KILL cr0, KILL cr1, KILL cr6, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12635
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12636
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12637
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12638
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12639
  ins_cost(250);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12640
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12641
  format %{ "String IndexOf SCL $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12642
            " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12643
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12644
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12645
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12646
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12647
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12648
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12649
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12650
                      $needle$$Register, needle_values, $tmp5$$Register, $needlecntImm$$constant,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12651
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12652
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12653
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12654
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12655
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12656
instruct indexOf_U(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt, iRegPsrc needle, rscratch2RegI needlecnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12657
                   iRegLdst tmp1, iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12658
                   flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12659
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12660
  effect(USE_KILL haycnt, USE_KILL needlecnt, /*better: TDEF haycnt, TDEF needlecnt,*/
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12661
         TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12662
         TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr0, KILL cr1, KILL cr6, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12663
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12664
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12665
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12666
  format %{ "String IndexOf $haystack[0..$haycnt], $needle[0..$needlecnt]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12667
             " -> $result \t// KILL $haycnt, $needlecnt, $tmp1, $tmp2, $tmp3, $tmp4, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12668
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12669
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12670
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12671
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12672
                      $needle$$Register, NULL, $needlecnt$$Register, 0,  // needlecnt not constant.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12673
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12674
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12675
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12676
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12677
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12678
instruct indexOf_L(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt, iRegPsrc needle, rscratch2RegI needlecnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12679
                   iRegLdst tmp1, iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12680
                   flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12681
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12682
  effect(USE_KILL haycnt, USE_KILL needlecnt, /*better: TDEF haycnt, TDEF needlecnt,*/
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12683
         TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12684
         TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr0, KILL cr1, KILL cr6, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12685
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12686
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12687
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12688
  format %{ "String IndexOf $haystack[0..$haycnt], $needle[0..$needlecnt]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12689
             " -> $result \t// KILL $haycnt, $needlecnt, $tmp1, $tmp2, $tmp3, $tmp4, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12690
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12691
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12692
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12693
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12694
                      $needle$$Register, NULL, $needlecnt$$Register, 0,  // needlecnt not constant.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12695
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12696
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12697
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12698
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12699
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12700
instruct indexOf_UL(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt, iRegPsrc needle, rscratch2RegI needlecnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12701
                    iRegLdst tmp1, iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12702
                    flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12703
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12704
  effect(USE_KILL haycnt, USE_KILL needlecnt, /*better: TDEF haycnt, TDEF needlecnt,*/
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12705
         TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12706
         TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr0, KILL cr1, KILL cr6, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12707
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12708
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12709
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12710
  format %{ "String IndexOf $haystack[0..$haycnt], $needle[0..$needlecnt]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12711
             " -> $result \t// KILL $haycnt, $needlecnt, $tmp1, $tmp2, $tmp3, $tmp4, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12712
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12713
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12714
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12715
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12716
                      $needle$$Register, NULL, $needlecnt$$Register, 0,  // needlecnt not constant.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12717
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12718
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12719
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12720
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12721
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12722
// char[] to byte[] compression
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12723
instruct string_compress(rarg1RegP src, rarg2RegP dst, iRegIsrc len, iRegIdst result, iRegLdst tmp1,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12724
                         iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4, iRegLdst tmp5, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12725
  match(Set result (StrCompressedCopy src (Binary dst len)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12726
  effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12727
         USE_KILL src, USE_KILL dst, KILL ctr, KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12728
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12729
  format %{ "String Compress $src,$dst,$len -> $result \t// KILL $tmp1, $tmp2, $tmp3, $tmp4, $tmp5" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12730
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12731
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12732
    Label Lskip, Ldone;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12733
    __ li($result$$Register, 0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12734
    __ string_compress_16($src$$Register, $dst$$Register, $len$$Register, $tmp1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12735
                          $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, $tmp5$$Register, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12736
    __ rldicl_($tmp1$$Register, $len$$Register, 0, 64-3); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12737
    __ beq(CCR0, Lskip);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12738
    __ string_compress($src$$Register, $dst$$Register, $tmp1$$Register, $tmp2$$Register, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12739
    __ bind(Lskip);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12740
    __ mr($result$$Register, $len$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12741
    __ bind(Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12742
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12743
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12744
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12745
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12746
// byte[] to char[] inflation
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12747
instruct string_inflate(Universe dummy, rarg1RegP src, rarg2RegP dst, iRegIsrc len, iRegLdst tmp1,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12748
                        iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4, iRegLdst tmp5, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12749
  match(Set dummy (StrInflatedCopy src (Binary dst len)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12750
  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, USE_KILL src, USE_KILL dst, KILL ctr, KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12751
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12752
  format %{ "String Inflate $src,$dst,$len \t// KILL $tmp1, $tmp2, $tmp3, $tmp4, $tmp5" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12753
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12754
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12755
    Label Ldone;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12756
    __ string_inflate_16($src$$Register, $dst$$Register, $len$$Register, $tmp1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12757
                         $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, $tmp5$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12758
    __ rldicl_($tmp1$$Register, $len$$Register, 0, 64-3); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12759
    __ beq(CCR0, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12760
    __ string_inflate($src$$Register, $dst$$Register, $tmp1$$Register, $tmp2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12761
    __ bind(Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12762
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12763
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12764
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12765
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12766
// StringCoding.java intrinsics
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12767
instruct has_negatives(rarg1RegP ary1, iRegIsrc len, iRegIdst result, iRegLdst tmp1, iRegLdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12768
                       regCTR ctr, flagsRegCR0 cr0)
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12769
%{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12770
  match(Set result (HasNegatives ary1 len));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12771
  effect(TEMP_DEF result, USE_KILL ary1, TEMP tmp1, TEMP tmp2, KILL ctr, KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12772
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12773
  format %{ "has negatives byte[] $ary1,$len -> $result \t// KILL $tmp1, $tmp2" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12774
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12775
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12776
    __ has_negatives($ary1$$Register, $len$$Register, $result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12777
                     $tmp1$$Register, $tmp2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12778
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12779
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12780
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12781
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12782
// encode char[] to byte[] in ISO_8859_1
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12783
instruct encode_iso_array(rarg1RegP src, rarg2RegP dst, iRegIsrc len, iRegIdst result, iRegLdst tmp1,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12784
                          iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4, iRegLdst tmp5, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12785
  match(Set result (EncodeISOArray src (Binary dst len)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12786
  effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12787
         USE_KILL src, USE_KILL dst, KILL ctr, KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12788
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12789
  format %{ "Encode array $src,$dst,$len -> $result \t// KILL $tmp1, $tmp2, $tmp3, $tmp4, $tmp5" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12790
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12791
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12792
    Label Lslow, Lfailure1, Lfailure2, Ldone;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12793
    __ string_compress_16($src$$Register, $dst$$Register, $len$$Register, $tmp1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12794
                          $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, $tmp5$$Register, Lfailure1);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12795
    __ rldicl_($result$$Register, $len$$Register, 0, 64-3); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12796
    __ beq(CCR0, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12797
    __ bind(Lslow);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12798
    __ string_compress($src$$Register, $dst$$Register, $result$$Register, $tmp2$$Register, Lfailure2);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12799
    __ li($result$$Register, 0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12800
    __ b(Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12801
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12802
    __ bind(Lfailure1);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12803
    __ mr($result$$Register, $len$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12804
    __ mfctr($tmp1$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12805
    __ rldimi_($result$$Register, $tmp1$$Register, 3, 0); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12806
    __ beq(CCR0, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12807
    __ b(Lslow);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12808
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12809
    __ bind(Lfailure2);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12810
    __ mfctr($result$$Register); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12811
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12812
    __ bind(Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12813
    __ subf($result$$Register, $result$$Register, $len$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12814
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12815
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12816
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12817
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12818
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12819
//---------- Min/Max Instructions ---------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12820
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12821
instruct minI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12822
  match(Set dst (MinI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12823
  ins_cost(DEFAULT_COST*6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12824
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12825
  expand %{
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12826
    iRegLdst src1s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12827
    iRegLdst src2s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12828
    iRegLdst diff;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12829
    iRegLdst sm;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12830
    iRegLdst doz; // difference or zero
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12831
    convI2L_reg(src1s, src1); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12832
    convI2L_reg(src2s, src2); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12833
    subL_reg_reg(diff, src2s, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12834
    // Need to consider >=33 bit result, therefore we need signmaskL.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12835
    signmask64L_regL(sm, diff);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12836
    andL_reg_reg(doz, diff, sm); // <=0
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12837
    addI_regL_regL(dst, doz, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12838
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12839
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12840
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12841
instruct minI_reg_reg_isel(iRegIdst dst, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12842
  match(Set dst (MinI src1 src2));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12843
  effect(KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12844
  predicate(VM_Version::has_isel());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12845
  ins_cost(DEFAULT_COST*2);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12846
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12847
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12848
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12849
    __ cmpw(CCR0, $src1$$Register, $src2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12850
    __ isel($dst$$Register, CCR0, Assembler::less, /*invert*/false, $src1$$Register, $src2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12851
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12852
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12853
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12854
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12855
instruct maxI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12856
  match(Set dst (MaxI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12857
  ins_cost(DEFAULT_COST*6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12858
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12859
  expand %{
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12860
    iRegLdst src1s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12861
    iRegLdst src2s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12862
    iRegLdst diff;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12863
    iRegLdst sm;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12864
    iRegLdst doz; // difference or zero
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12865
    convI2L_reg(src1s, src1); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12866
    convI2L_reg(src2s, src2); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12867
    subL_reg_reg(diff, src2s, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12868
    // Need to consider >=33 bit result, therefore we need signmaskL.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12869
    signmask64L_regL(sm, diff);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12870
    andcL_reg_reg(doz, diff, sm); // >=0
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12871
    addI_regL_regL(dst, doz, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12872
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12873
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12874
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12875
instruct maxI_reg_reg_isel(iRegIdst dst, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12876
  match(Set dst (MaxI src1 src2));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12877
  effect(KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12878
  predicate(VM_Version::has_isel());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12879
  ins_cost(DEFAULT_COST*2);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12880
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12881
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12882
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12883
    __ cmpw(CCR0, $src1$$Register, $src2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12884
    __ isel($dst$$Register, CCR0, Assembler::greater, /*invert*/false, $src1$$Register, $src2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12885
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12886
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12887
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12888
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12889
//---------- Population Count Instructions ------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12890
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12891
// Popcnt for Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12892
instruct popCountI(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12893
  match(Set dst (PopCountI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12894
  predicate(UsePopCountInstruction && VM_Version::has_popcntw());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12895
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12896
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12897
  format %{ "POPCNTW $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12898
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12899
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12900
    // TODO: PPC port $archOpcode(ppc64Opcode_popcntb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12901
    __ popcntw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12902
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12903
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12904
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12905
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12906
// Popcnt for Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12907
instruct popCountL(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12908
  predicate(UsePopCountInstruction && VM_Version::has_popcntw());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12909
  match(Set dst (PopCountL src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12910
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12911
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12912
  format %{ "POPCNTD $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12913
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12914
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12915
    // TODO: PPC port $archOpcode(ppc64Opcode_popcntb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12916
    __ popcntd($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12917
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12918
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12919
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12920
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12921
instruct countLeadingZerosI(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12922
  match(Set dst (CountLeadingZerosI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12923
  predicate(UseCountLeadingZerosInstructionsPPC64);  // See Matcher::match_rule_supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12924
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12925
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12926
  format %{ "CNTLZW  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12927
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12928
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12929
    // TODO: PPC port $archOpcode(ppc64Opcode_cntlzw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12930
    __ cntlzw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12931
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12932
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12933
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12934
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12935
instruct countLeadingZerosL(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12936
  match(Set dst (CountLeadingZerosL src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12937
  predicate(UseCountLeadingZerosInstructionsPPC64);  // See Matcher::match_rule_supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12938
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12939
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12940
  format %{ "CNTLZD  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12941
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12942
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12943
    // TODO: PPC port $archOpcode(ppc64Opcode_cntlzd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12944
    __ cntlzd($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12945
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12946
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12947
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12948
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12949
instruct countLeadingZerosP(iRegIdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12950
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12951
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12952
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12953
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12954
  format %{ "CNTLZD  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12955
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12956
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12957
    // TODO: PPC port $archOpcode(ppc64Opcode_cntlzd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12958
    __ cntlzd($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12959
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12960
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12961
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12962
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12963
instruct countTrailingZerosI_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12964
  match(Set dst (CountTrailingZerosI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12965
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12966
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12967
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12968
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12969
    immI16 imm1 %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12970
    immI16 imm2 %{ (int)32 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12971
    immI_minus1 m1 %{ -1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12972
    iRegIdst tmpI1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12973
    iRegIdst tmpI2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12974
    iRegIdst tmpI3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12975
    addI_reg_imm16(tmpI1, src, imm1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12976
    andcI_reg_reg(tmpI2, src, m1, tmpI1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12977
    countLeadingZerosI(tmpI3, tmpI2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12978
    subI_imm16_reg(dst, imm2, tmpI3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12979
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12980
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12981
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12982
instruct countTrailingZerosL_Ex(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12983
  match(Set dst (CountTrailingZerosL src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12984
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12985
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12986
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12987
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12988
    immL16 imm1 %{ (long)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12989
    immI16 imm2 %{ (int)64 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12990
    iRegLdst tmpL1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12991
    iRegLdst tmpL2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12992
    iRegIdst tmpL3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12993
    addL_reg_imm16(tmpL1, src, imm1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12994
    andcL_reg_reg(tmpL2, tmpL1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12995
    countLeadingZerosL(tmpL3, tmpL2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12996
    subI_imm16_reg(dst, imm2, tmpL3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12997
 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12998
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12999
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13000
// Expand nodes for byte_reverse_int.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13001
instruct insrwi_a(iRegIdst dst, iRegIsrc src, immI16 pos, immI16 shift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13002
  effect(DEF dst, USE src, USE pos, USE shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13003
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13004
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13005
  format %{ "INSRWI  $dst, $src, $pos, $shift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13006
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13007
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13008
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13009
    __ insrwi($dst$$Register, $src$$Register, $shift$$constant, $pos$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13010
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13011
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13012
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13013
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13014
// As insrwi_a, but with USE_DEF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13015
instruct insrwi(iRegIdst dst, iRegIsrc src, immI16 pos, immI16 shift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13016
  effect(USE_DEF dst, USE src, USE pos, USE shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13017
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13018
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13019
  format %{ "INSRWI  $dst, $src, $pos, $shift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13020
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13021
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13022
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13023
    __ insrwi($dst$$Register, $src$$Register, $shift$$constant, $pos$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13024
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13025
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13026
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13027
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13028
// Just slightly faster than java implementation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13029
instruct bytes_reverse_int_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13030
  match(Set dst (ReverseBytesI src));
46521
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13031
  ins_cost(7*DEFAULT_COST);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13032
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13033
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13034
    immI16 imm24 %{ (int) 24 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13035
    immI16 imm16 %{ (int) 16 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13036
    immI16  imm8 %{ (int)  8 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13037
    immI16  imm4 %{ (int)  4 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13038
    immI16  imm0 %{ (int)  0 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13039
    iRegLdst tmpI1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13040
    iRegLdst tmpI2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13041
    iRegLdst tmpI3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13042
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13043
    urShiftI_reg_imm(tmpI1, src, imm24);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13044
    insrwi_a(dst, tmpI1, imm24, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13045
    urShiftI_reg_imm(tmpI2, src, imm16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13046
    insrwi(dst, tmpI2, imm8, imm16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13047
    urShiftI_reg_imm(tmpI3, src, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13048
    insrwi(dst, tmpI3, imm8, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13049
    insrwi(dst, src, imm0, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13050
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13051
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13052
46521
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13053
instruct bytes_reverse_long_Ex(iRegLdst dst, iRegLsrc src) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13054
  match(Set dst (ReverseBytesL src));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13055
  ins_cost(15*DEFAULT_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13056
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13057
  expand %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13058
    immI16 imm56 %{ (int) 56 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13059
    immI16 imm48 %{ (int) 48 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13060
    immI16 imm40 %{ (int) 40 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13061
    immI16 imm32 %{ (int) 32 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13062
    immI16 imm24 %{ (int) 24 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13063
    immI16 imm16 %{ (int) 16 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13064
    immI16  imm8 %{ (int)  8 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13065
    immI16  imm0 %{ (int)  0 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13066
    iRegLdst tmpL1;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13067
    iRegLdst tmpL2;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13068
    iRegLdst tmpL3;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13069
    iRegLdst tmpL4;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13070
    iRegLdst tmpL5;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13071
    iRegLdst tmpL6;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13072
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13073
                                        // src   : |a|b|c|d|e|f|g|h|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13074
    rldicl(tmpL1, src, imm8, imm24);    // tmpL1 : | | | |e|f|g|h|a|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13075
    rldicl(tmpL2, tmpL1, imm32, imm24); // tmpL2 : | | | |a| | | |e|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13076
    rldicl(tmpL3, tmpL2, imm32, imm0);  // tmpL3 : | | | |e| | | |a|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13077
    rldicl(tmpL1, src, imm16, imm24);   // tmpL1 : | | | |f|g|h|a|b|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13078
    rldicl(tmpL2, tmpL1, imm32, imm24); // tmpL2 : | | | |b| | | |f|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13079
    rldicl(tmpL4, tmpL2, imm40, imm0);  // tmpL4 : | | |f| | | |b| |
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13080
    orL_reg_reg(tmpL5, tmpL3, tmpL4);   // tmpL5 : | | |f|e| | |b|a|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13081
    rldicl(tmpL1, src, imm24, imm24);   // tmpL1 : | | | |g|h|a|b|c|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13082
    rldicl(tmpL2, tmpL1, imm32, imm24); // tmpL2 : | | | |c| | | |g|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13083
    rldicl(tmpL3, tmpL2, imm48, imm0);  // tmpL3 : | |g| | | |c| | |
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13084
    rldicl(tmpL1, src, imm32, imm24);   // tmpL1 : | | | |h|a|b|c|d|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13085
    rldicl(tmpL2, tmpL1, imm32, imm24); // tmpL2 : | | | |d| | | |h|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13086
    rldicl(tmpL4, tmpL2, imm56, imm0);  // tmpL4 : |h| | | |d| | | |
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13087
    orL_reg_reg(tmpL6, tmpL3, tmpL4);   // tmpL6 : |h|g| | |d|c| | |
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13088
    orL_reg_reg(dst, tmpL5, tmpL6);     // dst   : |h|g|f|e|d|c|b|a|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13089
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13090
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13091
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13092
instruct bytes_reverse_ushort_Ex(iRegIdst dst, iRegIsrc src) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13093
  match(Set dst (ReverseBytesUS src));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13094
  ins_cost(2*DEFAULT_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13095
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13096
  expand %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13097
    immI16  imm16 %{ (int) 16 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13098
    immI16   imm8 %{ (int)  8 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13099
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13100
    urShiftI_reg_imm(dst, src, imm8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13101
    insrwi(dst, src, imm16, imm8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13102
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13103
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13104
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13105
instruct bytes_reverse_short_Ex(iRegIdst dst, iRegIsrc src) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13106
  match(Set dst (ReverseBytesS src));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13107
  ins_cost(3*DEFAULT_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13108
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13109
  expand %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13110
    immI16  imm16 %{ (int) 16 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13111
    immI16   imm8 %{ (int)  8 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13112
    iRegLdst tmpI1;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13113
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13114
    urShiftI_reg_imm(tmpI1, src, imm8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13115
    insrwi(tmpI1, src, imm16, imm8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13116
    extsh(dst, tmpI1);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13117
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13118
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13119
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13120
// Load Integer reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13121
instruct loadI_reversed(iRegIdst dst, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13122
  match(Set dst (ReverseBytesI (LoadI mem)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13123
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13124
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13125
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13126
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13127
    __ lwbrx($dst$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13128
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13129
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13130
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13131
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13132
// Load Long - aligned and reversed
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13133
instruct loadL_reversed(iRegLdst dst, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13134
  match(Set dst (ReverseBytesL (LoadL mem)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13135
  predicate(VM_Version::has_ldbrx());
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13136
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13137
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13138
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13139
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13140
    __ ldbrx($dst$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13141
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13142
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13143
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13144
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13145
// Load unsigned short / char reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13146
instruct loadUS_reversed(iRegIdst dst, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13147
  match(Set dst (ReverseBytesUS (LoadUS mem)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13148
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13149
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13150
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13151
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13152
    __ lhbrx($dst$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13153
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13154
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13155
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13156
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13157
// Load short reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13158
instruct loadS_reversed(iRegIdst dst, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13159
  match(Set dst (ReverseBytesS (LoadS mem)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13160
  ins_cost(MEMORY_REF_COST + DEFAULT_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13161
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13162
  size(8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13163
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13164
    __ lhbrx($dst$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13165
    __ extsh($dst$$Register, $dst$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13166
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13167
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13168
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13169
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13170
// Store Integer reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13171
instruct storeI_reversed(iRegIsrc src, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13172
  match(Set mem (StoreI mem (ReverseBytesI src)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13173
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13174
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13175
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13176
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13177
    __ stwbrx($src$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13178
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13179
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13180
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13181
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13182
// Store Long reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13183
instruct storeL_reversed(iRegLsrc src, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13184
  match(Set mem (StoreL mem (ReverseBytesL src)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13185
  predicate(VM_Version::has_stdbrx());
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13186
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13187
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13188
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13189
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13190
    __ stdbrx($src$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13191
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13192
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13193
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13194
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13195
// Store unsigned short / char reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13196
instruct storeUS_reversed(iRegIsrc src, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13197
  match(Set mem (StoreC mem (ReverseBytesUS src)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13198
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13199
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13200
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13201
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13202
    __ sthbrx($src$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13203
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13204
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13205
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13206
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13207
// Store short reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13208
instruct storeS_reversed(iRegIsrc src, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13209
  match(Set mem (StoreC mem (ReverseBytesS src)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13210
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13211
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13212
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13213
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13214
    __ sthbrx($src$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13215
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13216
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13217
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13218
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13219
//---------- Replicate Vector Instructions ------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13220
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13221
// Insrdi does replicate if src == dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13222
instruct repl32(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13223
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13224
  effect(USE_DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13225
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13226
  format %{ "INSRDI  $dst, #0, $dst, #32 \t// replicate" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13227
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13228
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13229
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13230
    __ insrdi($dst$$Register, $dst$$Register, 32, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13231
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13232
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13233
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13234
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13235
// Insrdi does replicate if src == dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13236
instruct repl48(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13237
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13238
  effect(USE_DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13239
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13240
  format %{ "INSRDI  $dst, #0, $dst, #48 \t// replicate" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13241
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13242
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13243
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13244
    __ insrdi($dst$$Register, $dst$$Register, 48, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13245
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13246
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13247
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13248
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13249
// Insrdi does replicate if src == dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13250
instruct repl56(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13251
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13252
  effect(USE_DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13253
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13254
  format %{ "INSRDI  $dst, #0, $dst, #56 \t// replicate" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13255
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13256
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13257
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13258
    __ insrdi($dst$$Register, $dst$$Register, 56, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13259
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13260
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13261
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13262
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13263
instruct repl8B_reg_Ex(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13264
  match(Set dst (ReplicateB src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13265
  predicate(n->as_Vector()->length() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13266
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13267
    moveReg(dst, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13268
    repl56(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13269
    repl48(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13270
    repl32(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13271
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13272
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13273
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13274
instruct repl8B_immI0(iRegLdst dst, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13275
  match(Set dst (ReplicateB zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13276
  predicate(n->as_Vector()->length() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13277
  format %{ "LI      $dst, #0 \t// replicate8B" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13278
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13279
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13280
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13281
    __ li($dst$$Register, (int)((short)($zero$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13282
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13283
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13284
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13285
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13286
instruct repl8B_immIminus1(iRegLdst dst, immI_minus1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13287
  match(Set dst (ReplicateB src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13288
  predicate(n->as_Vector()->length() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13289
  format %{ "LI      $dst, #-1 \t// replicate8B" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13290
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13291
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13292
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13293
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13294
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13295
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13296
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13297
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13298
instruct repl4S_reg_Ex(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13299
  match(Set dst (ReplicateS src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13300
  predicate(n->as_Vector()->length() == 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13301
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13302
    moveReg(dst, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13303
    repl48(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13304
    repl32(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13305
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13306
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13307
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13308
instruct repl4S_immI0(iRegLdst dst, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13309
  match(Set dst (ReplicateS zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13310
  predicate(n->as_Vector()->length() == 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13311
  format %{ "LI      $dst, #0 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13312
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13313
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13314
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13315
    __ li($dst$$Register, (int)((short)($zero$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13316
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13317
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13318
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13319
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13320
instruct repl4S_immIminus1(iRegLdst dst, immI_minus1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13321
  match(Set dst (ReplicateS src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13322
  predicate(n->as_Vector()->length() == 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13323
  format %{ "LI      $dst, -1 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13324
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13325
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13326
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13327
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13328
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13329
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13330
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13331
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13332
instruct repl2I_reg_Ex(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13333
  match(Set dst (ReplicateI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13334
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13335
  ins_cost(2 * DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13336
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13337
    moveReg(dst, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13338
    repl32(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13339
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13340
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13341
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13342
instruct repl2I_immI0(iRegLdst dst, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13343
  match(Set dst (ReplicateI zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13344
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13345
  format %{ "LI      $dst, #0 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13346
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13347
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13348
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13349
    __ li($dst$$Register, (int)((short)($zero$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13350
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13351
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13352
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13353
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13354
instruct repl2I_immIminus1(iRegLdst dst, immI_minus1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13355
  match(Set dst (ReplicateI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13356
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13357
  format %{ "LI      $dst, -1 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13358
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13359
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13360
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13361
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13362
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13363
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13364
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13365
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13366
// Move float to int register via stack, replicate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13367
instruct repl2F_reg_Ex(iRegLdst dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13368
  match(Set dst (ReplicateF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13369
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13370
  ins_cost(2 * MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13371
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13372
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13373
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13374
    moveF2I_reg_stack(tmpS, src);   // Move float to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13375
    moveF2I_stack_reg(tmpI, tmpS);  // Move stack to int reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13376
    moveReg(dst, tmpI);             // Move int to long reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13377
    repl32(dst);                    // Replicate bitpattern.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13378
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13379
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13380
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13381
// Replicate scalar constant to packed float values in Double register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13382
instruct repl2F_immF_Ex(iRegLdst dst, immF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13383
  match(Set dst (ReplicateF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13384
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13385
  ins_cost(5 * DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13386
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13387
  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
 13388
  postalloc_expand( postalloc_expand_load_replF_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13389
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13390
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13391
// Replicate scalar zero constant to packed float values in Double register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13392
instruct repl2F_immF0(iRegLdst dst, immF_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13393
  match(Set dst (ReplicateF zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13394
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13395
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13396
  format %{ "LI      $dst, #0 \t// replicate2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13397
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13398
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13399
    __ li($dst$$Register, 0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13400
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13401
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13402
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13403
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13404
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13405
//----------Overflow Math Instructions-----------------------------------------
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13406
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13407
// Note that we have to make sure that XER.SO is reset before using overflow instructions.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13408
// Simple Overflow operations can be matched by very few instructions (e.g. addExact: xor, and_, bc).
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13409
// Seems like only Long intrinsincs have an advantage. (The only expensive one is OverflowMulL.)
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13410
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13411
instruct overflowAddL_reg_reg(flagsRegCR0 cr0, iRegLsrc op1, iRegLsrc op2) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13412
  match(Set cr0 (OverflowAddL op1 op2));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13413
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13414
  format %{ "add_    $op1, $op2\t# overflow check long" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13415
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13416
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13417
    __ li(R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13418
    __ mtxer(R0); // clear XER.SO
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13419
    __ addo_(R0, $op1$$Register, $op2$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13420
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13421
  ins_pipe(pipe_class_default);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13422
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13423
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13424
instruct overflowSubL_reg_reg(flagsRegCR0 cr0, iRegLsrc op1, iRegLsrc op2) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13425
  match(Set cr0 (OverflowSubL op1 op2));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13426
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13427
  format %{ "subfo_  R0, $op2, $op1\t# overflow check long" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13428
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13429
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13430
    __ li(R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13431
    __ mtxer(R0); // clear XER.SO
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13432
    __ subfo_(R0, $op2$$Register, $op1$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13433
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13434
  ins_pipe(pipe_class_default);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13435
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13436
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13437
instruct overflowNegL_reg(flagsRegCR0 cr0, immL_0 zero, iRegLsrc op2) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13438
  match(Set cr0 (OverflowSubL zero op2));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13439
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13440
  format %{ "nego_   R0, $op2\t# overflow check long" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13441
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13442
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13443
    __ li(R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13444
    __ mtxer(R0); // clear XER.SO
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13445
    __ nego_(R0, $op2$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13446
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13447
  ins_pipe(pipe_class_default);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13448
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13449
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13450
instruct overflowMulL_reg_reg(flagsRegCR0 cr0, iRegLsrc op1, iRegLsrc op2) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13451
  match(Set cr0 (OverflowMulL op1 op2));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13452
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13453
  format %{ "mulldo_ R0, $op1, $op2\t# overflow check long" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13454
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13455
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13456
    __ li(R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13457
    __ mtxer(R0); // clear XER.SO
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13458
    __ mulldo_(R0, $op1$$Register, $op2$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13459
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13460
  ins_pipe(pipe_class_default);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13461
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13462
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13463
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13464
// ============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13465
// Safepoint Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13466
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13467
instruct safePoint_poll(iRegPdst poll) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13468
  match(SafePoint poll);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13469
  predicate(LoadPollAddressFromThread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13470
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13471
  // 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
 13472
  // effect no longer needs to be mentioned, since r0 is not contained
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13473
  // in a reg_class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13474
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13475
  format %{ "LD      R0, #0, $poll \t// Safepoint poll for GC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13476
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13477
  ins_encode( enc_poll(0x0, poll) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13478
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13479
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13480
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13481
// Safepoint without per-thread support. Load address of page to poll
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13482
// as constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13483
// Rscratch2RegP is R12.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13484
// LoadConPollAddr node is added in pd_post_matching_hook(). It must be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13485
// 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
 13486
instruct safePoint_poll_conPollAddr(rscratch2RegP poll) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13487
  match(SafePoint poll);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13488
  predicate(!LoadPollAddressFromThread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13489
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13490
  // 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
 13491
  // effect no longer needs to be mentioned, since r0 is not contained
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13492
  // in a reg_class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13493
23492
af5352f40e65 8037915: PPC64/AIX: Several smaller fixes
goetz
parents: 23211
diff changeset
 13494
  format %{ "LD      R0, #0, R12 \t// Safepoint poll for GC" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13495
  ins_encode( enc_poll(0x0, poll) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13496
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13497
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13498
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13499
// ============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13500
// Call Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13501
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13502
// Call Java Static Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13503
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13504
// Schedulable version of call static node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13505
instruct CallStaticJavaDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13506
  match(CallStaticJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13507
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13508
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13509
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13510
  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
 13511
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13512
  format %{ "CALL,static $meth \t// ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13513
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13514
  ins_encode( enc_java_static_call(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13515
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13516
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13517
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13518
// Call Java Dynamic Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13519
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13520
// Used by postalloc expand of CallDynamicJavaDirectSchedEx (actual call).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13521
// 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
 13522
// 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
 13523
// The call destination must still be placed in the constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13524
instruct CallDynamicJavaDirectSched(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13525
  match(CallDynamicJava); // To get all the data fields we need ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13526
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13527
  predicate(false);       // ... but never match.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13528
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13529
  ins_field_load_ic_hi_node(loadConL_hiNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13530
  ins_field_load_ic_node(loadConLNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13531
  ins_num_consts(1 /* 1 patchable constant: call destination */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13532
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13533
  format %{ "BL        \t// dynamic $meth ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13534
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13535
  ins_encode( enc_java_dynamic_call_sched(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13536
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13537
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13538
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13539
// Schedulable (i.e. postalloc expanded) version of call dynamic java.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13540
// We use postalloc expanded calls if we use inline caches
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13541
// and do not update method data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13542
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13543
// This instruction has two constants: inline cache (IC) and call destination.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13544
// 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
 13545
// one constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13546
instruct CallDynamicJavaDirectSched_Ex(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13547
  match(CallDynamicJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13548
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13549
  predicate(UseInlineCaches);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13550
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13551
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13552
  ins_num_consts(2 /* 2 patchable constants: inline cache, call destination. */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13553
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13554
  format %{ "CALL,dynamic $meth \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13555
  postalloc_expand( postalloc_expand_java_dynamic_call_sched(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13556
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13557
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13558
// Compound version of call dynamic java
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13559
// We use postalloc expanded calls if we use inline caches
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13560
// and do not update method data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13561
instruct CallDynamicJavaDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13562
  match(CallDynamicJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13563
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13564
  predicate(!UseInlineCaches);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13565
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13567
  // 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
 13568
  ins_num_consts(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13569
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13570
  format %{ "CALL,dynamic $meth \t// ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13571
  ins_encode( enc_java_dynamic_call(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13572
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13573
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13574
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13575
// Call Runtime Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13576
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13577
instruct CallRuntimeDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13578
  match(CallRuntime);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13579
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13580
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13581
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13582
  // Enc_java_to_runtime_call needs up to 3 constants: call target,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13583
  // env for callee, C-toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13584
  ins_num_consts(3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13585
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13586
  format %{ "CALL,runtime" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13587
  ins_encode( enc_java_to_runtime_call(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13588
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13589
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13590
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13591
// Call Leaf
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13592
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13593
// Used by postalloc expand of CallLeafDirect_Ex (mtctr).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13594
instruct CallLeafDirect_mtctr(iRegLdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13595
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13596
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13597
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13598
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13599
  format %{ "MTCTR   $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13600
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13601
  ins_encode( enc_leaf_call_mtctr(src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13602
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13603
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13604
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13605
// Used by postalloc expand of CallLeafDirect_Ex (actual call).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13606
instruct CallLeafDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13607
  match(CallLeaf);   // To get the data all the data fields we need ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13608
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13609
  predicate(false);  // but never match.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13610
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13611
  format %{ "BCTRL     \t// leaf call $meth ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13612
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13613
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13614
    // TODO: PPC port $archOpcode(ppc64Opcode_bctrl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13615
    __ bctrl();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13616
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13617
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13618
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13619
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13620
// postalloc expand of CallLeafDirect.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13621
// Load adress to call from TOC, then bl to it.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13622
instruct CallLeafDirect_Ex(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13623
  match(CallLeaf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13624
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13625
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13626
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13627
  // 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
 13628
  // env for callee, C-toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13629
  ins_num_consts(3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13630
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13631
  format %{ "CALL,runtime leaf $meth \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13632
  postalloc_expand( postalloc_expand_java_to_runtime_call(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13633
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13634
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13635
// Call runtime without safepoint - same as CallLeaf.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13636
// postalloc expand of CallLeafNoFPDirect.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13637
// Load adress to call from TOC, then bl to it.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13638
instruct CallLeafNoFPDirect_Ex(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13639
  match(CallLeafNoFP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13640
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13641
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13642
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13643
  // Enc_java_to_runtime_call needs up to 3 constants: call target,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13644
  // env for callee, C-toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13645
  ins_num_consts(3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13646
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13647
  format %{ "CALL,runtime leaf nofp $meth \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13648
  postalloc_expand( postalloc_expand_java_to_runtime_call(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13649
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13650
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13651
// Tail Call; Jump from runtime stub to Java code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13652
// Also known as an 'interprocedural jump'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13653
// Target of jump will eventually return to caller.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13654
// TailJump below removes the return address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13655
instruct TailCalljmpInd(iRegPdstNoScratch jump_target, inline_cache_regP method_oop) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13656
  match(TailCall jump_target method_oop);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13657
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13658
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13659
  format %{ "MTCTR   $jump_target \t// $method_oop holds method oop\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13660
            "BCTR         \t// tail call" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13661
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13662
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13663
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13664
    __ mtctr($jump_target$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13665
    __ bctr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13666
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13667
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13668
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13669
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13670
// Return Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13671
instruct Ret() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13672
  match(Return);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13673
  format %{ "BLR      \t// branch to link register" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13674
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13675
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13676
    // TODO: PPC port $archOpcode(ppc64Opcode_blr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13677
    // LR is restored in MachEpilogNode. Just do the RET here.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13678
    __ blr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13679
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13680
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13681
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13682
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13683
// Tail Jump; remove the return address; jump to target.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13684
// TailCall above leaves the return address around.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13685
// 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
 13686
// 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
 13687
// "restore" before this instruction (in Epilogue), we need to materialize it
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13688
// in %i0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13689
instruct tailjmpInd(iRegPdstNoScratch jump_target, rarg1RegP ex_oop) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13690
  match(TailJump jump_target ex_oop);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13691
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13692
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13693
  format %{ "LD      R4_ARG2 = LR\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13694
            "MTCTR   $jump_target\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13695
            "BCTR     \t// TailJump, exception oop: $ex_oop" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13696
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13697
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13698
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13699
    __ ld(R4_ARG2/* issuing pc */, _abi(lr), R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13700
    __ mtctr($jump_target$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13701
    __ bctr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13702
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13703
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13704
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13705
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13706
// Create exception oop: created by stack-crawling runtime code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13707
// Created exception is now available to this handler, and is setup
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13708
// just prior to jumping to this handler. No code emitted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13709
instruct CreateException(rarg1RegP ex_oop) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13710
  match(Set ex_oop (CreateEx));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13711
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13712
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13713
  format %{ " -- \t// exception oop; no code emitted" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13714
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13715
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13716
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13717
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13718
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13719
// Rethrow exception: The exception oop will come in the first
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13720
// argument position. Then JUMP (not call) to the rethrow stub code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13721
instruct RethrowException() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13722
  match(Rethrow);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13723
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13724
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13725
  format %{ "Jmp     rethrow_stub" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13726
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13727
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13728
    cbuf.set_insts_mark();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13729
    __ b64_patchable((address)OptoRuntime::rethrow_stub(), relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13730
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13731
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13732
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13733
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13734
// Die now.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13735
instruct ShouldNotReachHere() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13736
  match(Halt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13737
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13738
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13739
  format %{ "ShouldNotReachHere" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13740
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13741
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13742
    // TODO: PPC port $archOpcode(ppc64Opcode_tdi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13743
    __ trap_should_not_reach_here();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13744
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13745
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13746
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13747
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13748
// 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
 13749
// forces a 'TypeRawPtr::BOTTOM' output type for this guy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13750
// Get a DEF on threadRegP, no costs, no encoding, use
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13751
// 'ins_should_rematerialize(true)' to avoid spilling.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13752
instruct tlsLoadP(threadRegP dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13753
  match(Set dst (ThreadLocal));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13754
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13755
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13756
  ins_should_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13757
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13758
  format %{ " -- \t// $dst=Thread::current(), empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13759
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13760
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13761
  ins_pipe(pipe_class_empty);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13762
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13763
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13764
//---Some PPC specific nodes---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13765
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13766
// Stop a group.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13767
instruct endGroup() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13768
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13769
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13770
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13771
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13772
  format %{ "End Bundle (ori r1, r1, 0)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13773
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13774
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13775
    // TODO: PPC port $archOpcode(ppc64Opcode_endgroup);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13776
    __ endgroup();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13777
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13778
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13779
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13780
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13781
// Nop instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13782
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13783
instruct fxNop() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13784
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13785
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13786
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13787
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13788
  format %{ "fxNop" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13789
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13790
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13791
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13792
    __ nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13793
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13794
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13795
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13796
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13797
instruct fpNop0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13798
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13799
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13800
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13801
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13802
  format %{ "fpNop0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13803
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13804
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13805
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13806
    __ fpnop0();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13807
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13808
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13809
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13810
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13811
instruct fpNop1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13812
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13813
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13814
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13815
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13816
  format %{ "fpNop1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13817
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13818
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13819
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13820
    __ fpnop1();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13821
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13822
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13823
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13824
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13825
instruct brNop0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13826
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13827
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13828
  format %{ "brNop0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13829
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13830
    // TODO: PPC port $archOpcode(ppc64Opcode_mcrf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13831
    __ brnop0();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13832
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13833
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13834
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13835
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13836
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13837
instruct brNop1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13838
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13839
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13840
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13841
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13842
  format %{ "brNop1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13843
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13844
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13845
    // TODO: PPC port $archOpcode(ppc64Opcode_mcrf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13846
    __ brnop1();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13847
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13848
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13849
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13850
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13851
instruct brNop2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13852
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13853
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13854
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13855
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13856
  format %{ "brNop2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13857
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13858
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13859
    // TODO: PPC port $archOpcode(ppc64Opcode_mcrf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13860
    __ brnop2();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13861
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13862
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13863
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13864
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13865
//----------PEEPHOLE RULES-----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13866
// These must follow all instruction definitions as they use the names
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13867
// defined in the instructions definitions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13868
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13869
// peepmatch ( root_instr_name [preceeding_instruction]* );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13870
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13871
// peepconstraint %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13872
// (instruction_number.operand_name relational_op instruction_number.operand_name
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13873
//  [, ...] );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13874
// // instruction numbers are zero-based using left to right order in peepmatch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13875
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13876
// peepreplace ( instr_name ( [instruction_number.operand_name]* ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13877
// // provide an instruction_number.operand_name for each operand that appears
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13878
// // in the replacement instruction's match rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13879
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13880
// ---------VM FLAGS---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13881
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13882
// All peephole optimizations can be turned off using -XX:-OptoPeephole
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13883
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13884
// Each peephole rule is given an identifying number starting with zero and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13885
// 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
 13886
// can be enabled, and all others disabled, by using -XX:OptoPeepholeAt=#
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13887
// on the command-line.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13888
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13889
// ---------CURRENT LIMITATIONS----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13890
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13891
// Only match adjacent instructions in same basic block
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13892
// Only equality constraints
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13893
// Only constraints between operands, not (0.dest_reg == EAX_enc)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13894
// Only one replacement instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13895
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13896
// ---------EXAMPLE----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13897
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13898
// // pertinent parts of existing instructions in architecture description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13899
// instruct movI(eRegI dst, eRegI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13900
//   match(Set dst (CopyI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13901
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13902
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13903
// instruct incI_eReg(eRegI dst, immI1 src, eFlagsReg cr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13904
//   match(Set dst (AddI dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13905
//   effect(KILL cr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13906
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13907
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13908
// // Change (inc mov) to lea
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13909
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13910
//   // increment preceeded by register-register move
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13911
//   peepmatch ( incI_eReg movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13912
//   // require that the destination register of the increment
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13913
//   // match the destination register of the move
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13914
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13915
//   // construct a replacement instruction that sets
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13916
//   // the destination to ( move's source register + one )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13917
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13918
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13919
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13920
// Implementation no longer uses movX instructions since
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13921
// machine-independent system no longer uses CopyX nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13922
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13923
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13924
//   peepmatch ( incI_eReg movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13925
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13926
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13927
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13928
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13929
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13930
//   peepmatch ( decI_eReg movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13931
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13932
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13933
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13934
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13935
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13936
//   peepmatch ( addI_eReg_imm movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13937
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13938
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13939
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13940
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13941
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13942
//   peepmatch ( addP_eReg_imm movP );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13943
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13944
//   peepreplace ( leaP_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13945
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13946
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13947
// // Change load of spilled value to only a spill
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13948
// instruct storeI(memory mem, eRegI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13949
//   match(Set mem (StoreI mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13950
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13951
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13952
// instruct loadI(eRegI dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13953
//   match(Set dst (LoadI mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13954
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13955
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13956
peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13957
  peepmatch ( loadI storeI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13958
  peepconstraint ( 1.src == 0.dst, 1.mem == 0.mem );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13959
  peepreplace ( storeI( 1.mem 1.mem 1.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13960
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13961
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13962
peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13963
  peepmatch ( loadL storeL );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13964
  peepconstraint ( 1.src == 0.dst, 1.mem == 0.mem );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13965
  peepreplace ( storeL( 1.mem 1.mem 1.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13966
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13967
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13968
peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13969
  peepmatch ( loadP storeP );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13970
  peepconstraint ( 1.src == 0.dst, 1.dst == 0.mem );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13971
  peepreplace ( storeP( 1.dst 1.dst 1.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13972
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13973
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13974
//----------SMARTSPILL RULES---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13975
// These must follow all instruction definitions as they use the names
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13976
// defined in the instructions definitions.