src/hotspot/cpu/ppc/ppc.ad
author mhorie
Thu, 05 Oct 2017 12:56:42 +0200
changeset 47594 fd0db78ac8d4
parent 47584 b02ea7eb7d93
child 48332 651a95f30dfb
permissions -rw-r--r--
8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX)) Reviewed-by: mdoerr
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
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   257
// ----------------------------
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   258
// Vector-Scalar Registers
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   259
// ----------------------------
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   260
  reg_def VSR0 ( SOC, SOC, Op_VecX, 0, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   261
  reg_def VSR1 ( SOC, SOC, Op_VecX, 1, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   262
  reg_def VSR2 ( SOC, SOC, Op_VecX, 2, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   263
  reg_def VSR3 ( SOC, SOC, Op_VecX, 3, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   264
  reg_def VSR4 ( SOC, SOC, Op_VecX, 4, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   265
  reg_def VSR5 ( SOC, SOC, Op_VecX, 5, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   266
  reg_def VSR6 ( SOC, SOC, Op_VecX, 6, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   267
  reg_def VSR7 ( SOC, SOC, Op_VecX, 7, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   268
  reg_def VSR8 ( SOC, SOC, Op_VecX, 8, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   269
  reg_def VSR9 ( SOC, SOC, Op_VecX, 9, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   270
  reg_def VSR10 ( SOC, SOC, Op_VecX, 10, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   271
  reg_def VSR11 ( SOC, SOC, Op_VecX, 11, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   272
  reg_def VSR12 ( SOC, SOC, Op_VecX, 12, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   273
  reg_def VSR13 ( SOC, SOC, Op_VecX, 13, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   274
  reg_def VSR14 ( SOC, SOC, Op_VecX, 14, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   275
  reg_def VSR15 ( SOC, SOC, Op_VecX, 15, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   276
  reg_def VSR16 ( SOC, SOC, Op_VecX, 16, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   277
  reg_def VSR17 ( SOC, SOC, Op_VecX, 17, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   278
  reg_def VSR18 ( SOC, SOC, Op_VecX, 18, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   279
  reg_def VSR19 ( SOC, SOC, Op_VecX, 19, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   280
  reg_def VSR20 ( SOC, SOC, Op_VecX, 20, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   281
  reg_def VSR21 ( SOC, SOC, Op_VecX, 21, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   282
  reg_def VSR22 ( SOC, SOC, Op_VecX, 22, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   283
  reg_def VSR23 ( SOC, SOC, Op_VecX, 23, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   284
  reg_def VSR24 ( SOC, SOC, Op_VecX, 24, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   285
  reg_def VSR25 ( SOC, SOC, Op_VecX, 25, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   286
  reg_def VSR26 ( SOC, SOC, Op_VecX, 26, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   287
  reg_def VSR27 ( SOC, SOC, Op_VecX, 27, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   288
  reg_def VSR28 ( SOC, SOC, Op_VecX, 28, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   289
  reg_def VSR29 ( SOC, SOC, Op_VecX, 29, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   290
  reg_def VSR30 ( SOC, SOC, Op_VecX, 30, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   291
  reg_def VSR31 ( SOC, SOC, Op_VecX, 31, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   292
  reg_def VSR32 ( SOC, SOC, Op_VecX, 32, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   293
  reg_def VSR33 ( SOC, SOC, Op_VecX, 33, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   294
  reg_def VSR34 ( SOC, SOC, Op_VecX, 34, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   295
  reg_def VSR35 ( SOC, SOC, Op_VecX, 35, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   296
  reg_def VSR36 ( SOC, SOC, Op_VecX, 36, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   297
  reg_def VSR37 ( SOC, SOC, Op_VecX, 37, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   298
  reg_def VSR38 ( SOC, SOC, Op_VecX, 38, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   299
  reg_def VSR39 ( SOC, SOC, Op_VecX, 39, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   300
  reg_def VSR40 ( SOC, SOC, Op_VecX, 40, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   301
  reg_def VSR41 ( SOC, SOC, Op_VecX, 41, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   302
  reg_def VSR42 ( SOC, SOC, Op_VecX, 42, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   303
  reg_def VSR43 ( SOC, SOC, Op_VecX, 43, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   304
  reg_def VSR44 ( SOC, SOC, Op_VecX, 44, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   305
  reg_def VSR45 ( SOC, SOC, Op_VecX, 45, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   306
  reg_def VSR46 ( SOC, SOC, Op_VecX, 46, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   307
  reg_def VSR47 ( SOC, SOC, Op_VecX, 47, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   308
  reg_def VSR48 ( SOC, SOC, Op_VecX, 48, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   309
  reg_def VSR49 ( SOC, SOC, Op_VecX, 49, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   310
  reg_def VSR50 ( SOC, SOC, Op_VecX, 50, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   311
  reg_def VSR51 ( SOC, SOC, Op_VecX, 51, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   312
  reg_def VSR52 ( SOC, SOC, Op_VecX, 52, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   313
  reg_def VSR53 ( SOC, SOC, Op_VecX, 53, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   314
  reg_def VSR54 ( SOC, SOC, Op_VecX, 54, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   315
  reg_def VSR55 ( SOC, SOC, Op_VecX, 55, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   316
  reg_def VSR56 ( SOC, SOC, Op_VecX, 56, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   317
  reg_def VSR57 ( SOC, SOC, Op_VecX, 57, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   318
  reg_def VSR58 ( SOC, SOC, Op_VecX, 58, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   319
  reg_def VSR59 ( SOC, SOC, Op_VecX, 59, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   320
  reg_def VSR60 ( SOC, SOC, Op_VecX, 60, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   321
  reg_def VSR61 ( SOC, SOC, Op_VecX, 61, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   322
  reg_def VSR62 ( SOC, SOC, Op_VecX, 62, NULL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   323
  reg_def VSR63 ( SOC, SOC, Op_VecX, 63, NULL);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   324
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   325
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   326
// Specify priority of register selection within phases of register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   327
// allocation. Highest priority is first. A useful heuristic is to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   328
// give registers a low priority when they are required by machine
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   329
// instructions, like EAX and EDX on I486, and choose no-save registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   330
// before save-on-call, & save-on-call before save-on-entry. Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   331
// which participate in fixed calling sequences should come last.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   332
// Registers which are used as pairs must fall on an even boundary.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   333
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   334
// It's worth about 1% on SPEC geomean to get this right.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   335
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   336
// 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
   337
// 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
   338
// 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
   339
// the same as R3->encoding()! Furthermore, we cannot make any
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   340
// 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
   341
// Additionally, the function
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   342
//   static enum RC rc_class(OptoReg::Name reg )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   343
// 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
   344
// and its current implementation relies on chunk0 and chunk1 having a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   345
// size of 64 each.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   346
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   347
// If you change this allocation class, please have a look at the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   348
// default values for the parameters RoundRobinIntegerRegIntervalStart
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   349
// and RoundRobinFloatRegIntervalStart
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   350
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   351
alloc_class chunk0 (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   352
  // Chunk0 contains *all* 64 integer registers halves.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   353
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   354
  // "non-volatile" registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   355
  R14, R14_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   356
  R15, R15_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   357
  R17, R17_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   358
  R18, R18_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   359
  R19, R19_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   360
  R20, R20_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   361
  R21, R21_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   362
  R22, R22_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   363
  R23, R23_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   364
  R24, R24_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   365
  R25, R25_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   366
  R26, R26_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   367
  R27, R27_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   368
  R28, R28_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   369
  R29, R29_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   370
  R30, R30_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   371
  R31, R31_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
  // scratch/special registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   374
  R11, R11_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   375
  R12, R12_H,
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
  // argument registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   378
  R10, R10_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   379
  R9,  R9_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   380
  R8,  R8_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   381
  R7,  R7_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   382
  R6,  R6_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   383
  R5,  R5_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   384
  R4,  R4_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   385
  R3,  R3_H,
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
  // special registers, not available for allocation
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   388
  R16, R16_H,     // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   389
  R13, R13_H,     // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   390
  R2,  R2_H,      // may be used for TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   391
  R1,  R1_H,      // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   392
  R0,  R0_H       // R0 (scratch)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   393
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   394
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   395
// If you change this allocation class, please have a look at the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   396
// default values for the parameters RoundRobinIntegerRegIntervalStart
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   397
// and RoundRobinFloatRegIntervalStart
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   398
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   399
alloc_class chunk1 (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   400
  // Chunk1 contains *all* 64 floating-point registers halves.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   401
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   402
  // scratch register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   403
  F0,  F0_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   404
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   405
  // argument registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   406
  F13, F13_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   407
  F12, F12_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   408
  F11, F11_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   409
  F10, F10_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   410
  F9,  F9_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   411
  F8,  F8_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   412
  F7,  F7_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   413
  F6,  F6_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   414
  F5,  F5_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   415
  F4,  F4_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   416
  F3,  F3_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   417
  F2,  F2_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   418
  F1,  F1_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   419
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   420
  // non-volatile registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   421
  F14, F14_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   422
  F15, F15_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   423
  F16, F16_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   424
  F17, F17_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   425
  F18, F18_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   426
  F19, F19_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   427
  F20, F20_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   428
  F21, F21_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   429
  F22, F22_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   430
  F23, F23_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   431
  F24, F24_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   432
  F25, F25_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   433
  F26, F26_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   434
  F27, F27_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   435
  F28, F28_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   436
  F29, F29_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   437
  F30, F30_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   438
  F31, F31_H
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   439
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   440
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   441
alloc_class chunk2 (
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   442
  // Chunk2 contains *all* 8 condition code registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   443
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   444
  CCR0,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   445
  CCR1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   446
  CCR2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   447
  CCR3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   448
  CCR4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   449
  CCR5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   450
  CCR6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   451
  CCR7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   452
);
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
alloc_class chunk3 (
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   455
  VSR0,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   456
  VSR1,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   457
  VSR2,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   458
  VSR3,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   459
  VSR4,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   460
  VSR5,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   461
  VSR6,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   462
  VSR7,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   463
  VSR8,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   464
  VSR9,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   465
  VSR10,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   466
  VSR11,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   467
  VSR12,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   468
  VSR13,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   469
  VSR14,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   470
  VSR15,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   471
  VSR16,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   472
  VSR17,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   473
  VSR18,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   474
  VSR19,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   475
  VSR20,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   476
  VSR21,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   477
  VSR22,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   478
  VSR23,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   479
  VSR24,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   480
  VSR25,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   481
  VSR26,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   482
  VSR27,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   483
  VSR28,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   484
  VSR29,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   485
  VSR30,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   486
  VSR31,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   487
  VSR32,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   488
  VSR33,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   489
  VSR34,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   490
  VSR35,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   491
  VSR36,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   492
  VSR37,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   493
  VSR38,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   494
  VSR39,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   495
  VSR40,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   496
  VSR41,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   497
  VSR42,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   498
  VSR43,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   499
  VSR44,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   500
  VSR45,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   501
  VSR46,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   502
  VSR47,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   503
  VSR48,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   504
  VSR49,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   505
  VSR50,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   506
  VSR51,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   507
  VSR52,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   508
  VSR53,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   509
  VSR54,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   510
  VSR55,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   511
  VSR56,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   512
  VSR57,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   513
  VSR58,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   514
  VSR59,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   515
  VSR60,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   516
  VSR61,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   517
  VSR62,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   518
  VSR63
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   519
);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   520
47594
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   521
alloc_class chunk4 (
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   522
  // special registers
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   523
  // These registers are not allocated, but used for nodes generated by postalloc expand.
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   524
  SR_XER,
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   525
  SR_LR,
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   526
  SR_CTR,
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   527
  SR_VRSAVE,
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   528
  SR_SPEFSCR,
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   529
  SR_PPR
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   530
);
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
   531
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   532
//-------Architecture Description Register Classes-----------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   533
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   534
// Several register classes are automatically defined based upon
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   535
// information in this architecture description.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   536
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   537
// 1) reg_class inline_cache_reg           ( as defined in frame section )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   538
// 2) reg_class compiler_method_oop_reg    ( as defined in frame section )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   539
// 2) reg_class interpreter_method_oop_reg ( as defined in frame section )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   540
// 3) reg_class stack_slots( /* one chunk of stack-based "registers" */ )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   541
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   542
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   543
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   544
// 32 Bit Register Classes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   545
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   546
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   547
// We specify registers twice, once as read/write, and once read-only.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   548
// We use the read-only registers for source operands. With this, we
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   549
// 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
   550
// '0'-register. (We used to simulate this on ppc.)
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
// 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
   553
// can be dest (or src) of normal instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   554
reg_class bits32_reg_rw(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   555
/*R0*/              // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   556
/*R1*/              // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   557
  R2,               // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   558
  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   559
  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   560
  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   561
  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   562
  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   563
  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   564
  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   565
  R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   566
  R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   567
  R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   568
/*R13*/             // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   569
  R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   570
  R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   571
/*R16*/             // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   572
  R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   573
  R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   574
  R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   575
  R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   576
  R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   577
  R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   578
  R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   579
  R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   580
  R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   581
  R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   582
  R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   583
  R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   584
/*R29,*/             // global TOC
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   585
  R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   586
  R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   587
);
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
// 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
   590
// only be src of all instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   591
reg_class bits32_reg_ro(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   592
/*R0*/              // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   593
/*R1*/              // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   594
  R2                // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   595
  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   596
  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   597
  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   598
  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   599
  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   600
  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   601
  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   602
  R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   603
  R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   604
  R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   605
/*R13*/             // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   606
  R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   607
  R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   608
/*R16*/             // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   609
  R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   610
  R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   611
  R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   612
  R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   613
  R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   614
  R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   615
  R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   616
  R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   617
  R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   618
  R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   619
  R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   620
  R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   621
/*R29,*/
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   622
  R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   623
  R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   624
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   625
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   626
reg_class rscratch1_bits32_reg(R11);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   627
reg_class rscratch2_bits32_reg(R12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   628
reg_class rarg1_bits32_reg(R3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   629
reg_class rarg2_bits32_reg(R4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   630
reg_class rarg3_bits32_reg(R5);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   631
reg_class rarg4_bits32_reg(R6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   632
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   633
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   634
// 64 Bit Register Classes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   635
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   636
// 64-bit build means 64-bit pointers means hi/lo pairs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   637
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   638
reg_class rscratch1_bits64_reg(R11_H, R11);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   639
reg_class rscratch2_bits64_reg(R12_H, R12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   640
reg_class rarg1_bits64_reg(R3_H, R3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   641
reg_class rarg2_bits64_reg(R4_H, R4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   642
reg_class rarg3_bits64_reg(R5_H, R5);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   643
reg_class rarg4_bits64_reg(R6_H, R6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   644
// Thread register, 'written' by tlsLoadP, see there.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   645
reg_class thread_bits64_reg(R16_H, R16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   646
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   647
reg_class r19_bits64_reg(R19_H, R19);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   648
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   649
// 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
   650
// can be dest (or src) of normal instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   651
reg_class bits64_reg_rw(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   652
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   653
/*R1_H,  R1*/     // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   654
  R2_H,  R2,      // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   655
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   656
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   657
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   658
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   659
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   660
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   661
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   662
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   663
  R11_H, R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   664
  R12_H, R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   665
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   666
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   667
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   668
/*R16_H, R16*/   // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   669
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   670
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   671
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   672
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   673
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   674
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   675
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   676
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   677
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   678
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   679
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   680
  R28_H, R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   681
/*R29_H, R29,*/
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   682
  R30_H, R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   683
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   684
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   685
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   686
// 64 bit registers used excluding r2, r11 and r12
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   687
// 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
   688
// r2, r11 and r12 internally.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   689
reg_class bits64_reg_leaf_call(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   690
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   691
/*R1_H,  R1*/     // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   692
/*R2_H,  R2*/     // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   693
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   694
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   695
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   696
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   697
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   698
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   699
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   700
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   701
/*R11_H, R11*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   702
/*R12_H, R12*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   703
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   704
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   705
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   706
/*R16_H, R16*/   // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   707
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   708
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   709
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   710
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   711
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   712
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   713
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   714
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   715
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   716
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   717
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   718
  R28_H, R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   719
/*R29_H, R29,*/
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   720
  R30_H, R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   721
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   722
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   723
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   724
// Used to hold the TOC to avoid collisions with expanded DynamicCall
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   725
// which uses r19 as inline cache internally and expanded LeafCall which uses
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   726
// r2, r11 and r12 internally.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   727
reg_class bits64_constant_table_base(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   728
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   729
/*R1_H,  R1*/     // SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   730
/*R2_H,  R2*/     // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   731
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   732
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   733
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   734
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   735
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   736
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   737
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   738
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   739
/*R11_H, R11*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   740
/*R12_H, R12*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   741
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   742
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   743
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   744
/*R16_H, R16*/   // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   745
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   746
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   747
/*R19_H, R19*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   748
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   749
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   750
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   751
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   752
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   753
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   754
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   755
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   756
  R28_H, R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   757
/*R29_H, R29,*/
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   758
  R30_H, R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   759
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   760
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   761
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   762
// 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
   763
// only be src of all instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   764
reg_class bits64_reg_ro(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   765
/*R0_H,  R0*/     // R0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   766
  R1_H,  R1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   767
  R2_H,  R2,       // TOC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   768
  R3_H,  R3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   769
  R4_H,  R4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   770
  R5_H,  R5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   771
  R6_H,  R6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   772
  R7_H,  R7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   773
  R8_H,  R8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   774
  R9_H,  R9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   775
  R10_H, R10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   776
  R11_H, R11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   777
  R12_H, R12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   778
/*R13_H, R13*/   // system thread id
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   779
  R14_H, R14,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   780
  R15_H, R15,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   781
  R16_H, R16,    // R16_thread
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   782
  R17_H, R17,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   783
  R18_H, R18,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   784
  R19_H, R19,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   785
  R20_H, R20,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   786
  R21_H, R21,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   787
  R22_H, R22,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   788
  R23_H, R23,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   789
  R24_H, R24,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   790
  R25_H, R25,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   791
  R26_H, R26,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   792
  R27_H, R27,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   793
  R28_H, R28,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   794
/*R29_H, R29,*/ // TODO: let allocator handle TOC!!
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   795
  R30_H, R30,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   796
  R31_H, R31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   797
);
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
// Special Class for Condition Code Flags Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   802
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   803
reg_class int_flags(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   804
/*CCR0*/             // scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   805
/*CCR1*/             // scratch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   806
/*CCR2*/             // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   807
/*CCR3*/             // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   808
/*CCR4*/             // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   809
  CCR5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   810
  CCR6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   811
  CCR7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   812
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   813
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   814
reg_class int_flags_ro(
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   815
  CCR0,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   816
  CCR1,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   817
  CCR2,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   818
  CCR3,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   819
  CCR4,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   820
  CCR5,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   821
  CCR6,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   822
  CCR7
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   823
);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
   824
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   825
reg_class int_flags_CR0(CCR0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   826
reg_class int_flags_CR1(CCR1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   827
reg_class int_flags_CR6(CCR6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   828
reg_class ctr_reg(SR_CTR);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   829
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   830
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   831
// Float Register Classes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   832
// ----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   833
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   834
reg_class flt_reg(
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
   835
  F0,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   836
  F1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   837
  F2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   838
  F3,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   839
  F4,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   840
  F5,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   841
  F6,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   842
  F7,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   843
  F8,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   844
  F9,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   845
  F10,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   846
  F11,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   847
  F12,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   848
  F13,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   849
  F14,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   850
  F15,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   851
  F16,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   852
  F17,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   853
  F18,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   854
  F19,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   855
  F20,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   856
  F21,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   857
  F22,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   858
  F23,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   859
  F24,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   860
  F25,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   861
  F26,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   862
  F27,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   863
  F28,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   864
  F29,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   865
  F30,              // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   866
  F31               // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   867
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   868
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   869
// Double precision float registers have virtual `high halves' that
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   870
// are needed by the allocator.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   871
reg_class dbl_reg(
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
   872
  F0,  F0_H,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   873
  F1,  F1_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   874
  F2,  F2_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   875
  F3,  F3_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   876
  F4,  F4_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   877
  F5,  F5_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   878
  F6,  F6_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   879
  F7,  F7_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   880
  F8,  F8_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   881
  F9,  F9_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   882
  F10, F10_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   883
  F11, F11_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   884
  F12, F12_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   885
  F13, F13_H,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   886
  F14, F14_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   887
  F15, F15_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   888
  F16, F16_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   889
  F17, F17_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   890
  F18, F18_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   891
  F19, F19_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   892
  F20, F20_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   893
  F21, F21_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   894
  F22, F22_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   895
  F23, F23_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   896
  F24, F24_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   897
  F25, F25_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   898
  F26, F26_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   899
  F27, F27_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   900
  F28, F28_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   901
  F29, F29_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   902
  F30, F30_H,    // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   903
  F31, F31_H     // nv!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   904
);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   905
47584
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   906
// ----------------------------
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   907
// Vector-Scalar Register Class
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   908
// ----------------------------
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   909
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   910
reg_class vs_reg(
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   911
  VSR32,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   912
  VSR33,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   913
  VSR34,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   914
  VSR35,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   915
  VSR36,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   916
  VSR37,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   917
  VSR38,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   918
  VSR39,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   919
  VSR40,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   920
  VSR41,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   921
  VSR42,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   922
  VSR43,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   923
  VSR44,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   924
  VSR45,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   925
  VSR46,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   926
  VSR47,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   927
  VSR48,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   928
  VSR49,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   929
  VSR50,
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   930
  VSR51
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   931
//  VSR52,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   932
//  VSR53,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   933
//  VSR54,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   934
//  VSR55,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   935
//  VSR56,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   936
//  VSR57,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   937
//  VSR58,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   938
//  VSR59,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   939
//  VSR60,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   940
//  VSR61,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   941
//  VSR62,     // nv!
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
   942
//  VSR63      // nv!
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   943
);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   944
22861
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
//----------DEFINITION BLOCK---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   948
// 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
   949
// Current support includes integer values in the range [0, 0x7FFFFFFF]
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   950
// Format:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   951
//        int_def  <name>         ( <int_value>, <expression>);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   952
// Generated Code in ad_<arch>.hpp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   953
//        #define  <name>   (<expression>)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   954
//        // value == <int_value>
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   955
// Generated code in ad_<arch>.cpp adlc_verification()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   956
//        assert( <name> == <int_value>, "Expect (<expression>) to equal <int_value>");
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
definitions %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   959
  // The default cost (of an ALU instruction).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   960
  int_def DEFAULT_COST_LOW        (     30,      30);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   961
  int_def DEFAULT_COST            (    100,     100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   962
  int_def HUGE_COST               (1000000, 1000000);
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
  // Memory refs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   965
  int_def MEMORY_REF_COST_LOW     (    200, DEFAULT_COST * 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   966
  int_def MEMORY_REF_COST         (    300, DEFAULT_COST * 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   967
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   968
  // Branches are even more expensive.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   969
  int_def BRANCH_COST             (    900, DEFAULT_COST * 9);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   970
  int_def CALL_COST               (   1300, DEFAULT_COST * 13);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   973
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   974
//----------SOURCE BLOCK-------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   975
// This is a block of C++ code which provides values, functions, and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   976
// definitions necessary in the rest of the architecture description.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   977
source_hpp %{
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   978
  // Header information of the source block.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   979
  // Method declarations/definitions which are used outside
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   980
  // the ad-scope can conveniently be defined here.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   981
  //
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   982
  // To keep related declarations/definitions/uses close together,
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
   983
  // 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
   984
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
   985
  // 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
   986
  // 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
   987
  // operation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   988
  bool followed_by_acquire(const Node *n);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   991
source %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
   992
38286
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   993
// 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
   994
// 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
   995
// into registers?
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   996
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
   997
  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
   998
}
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
   999
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
  1000
void Compile::reshape_address(AddPNode* addp) {
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
  1001
}
0ddb6f84e138 8154826: AArch64: take advantage better of base + shifted offset addressing mode
roland
parents: 38236
diff changeset
  1002
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1003
// Optimize load-acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1004
//
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  1005
// Check if acquire is unnecessary due to following operation that does
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1006
// acquire anyways.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1007
// Walk the pattern:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1008
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1009
//      n: Load.acq
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
//      MemBarAcquire
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
//  Proj(ctrl)  Proj(mem)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1014
//       |         |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1015
//   MemBarRelease/Volatile
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  1016
//
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1017
bool followed_by_acquire(const Node *load) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1018
  assert(load->is_Load(), "So far implemented only for loads.");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1019
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1020
  // Find MemBarAcquire.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  1021
  const Node *mba = NULL;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1022
  for (DUIterator_Fast imax, i = load->fast_outs(imax); i < imax; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1023
    const Node *out = load->fast_out(i);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1024
    if (out->Opcode() == Op_MemBarAcquire) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1025
      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
  1026
      mba = out;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1027
      break;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1028
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1029
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1030
  if (!mba) return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1031
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1032
  // Find following MemBar node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1033
  //
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  1034
  // The following node must be reachable by control AND memory
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1035
  // edge to assure no other operations are in between the two nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1036
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1037
  // 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
  1038
  Node *mem_proj = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1039
  for (DUIterator_Fast imax, i = mba->fast_outs(imax); i < imax; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1040
    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
  1041
    assert(mem_proj->is_Proj(), "only projections here");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1042
    ProjNode *proj = mem_proj->as_Proj();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1043
    if (proj->_con == TypeFunc::Memory &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1044
        !Compile::current()->node_arena()->contains(mem_proj)) // Unmatched old-space only
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1045
      break;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1046
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1047
  assert(mem_proj->as_Proj()->_con == TypeFunc::Memory, "Graph broken");
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
  // Search MemBar behind Proj. If there are other memory operations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1050
  // behind the Proj we lost.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1051
  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
  1052
    Node *x = mem_proj->fast_out(j);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1053
    // 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
  1054
    if (x->is_Mem()) return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1055
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1056
    // On PPC64 release and volatile are implemented by an instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1057
    // 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
  1058
    // acquire before these.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1059
    int xop = x->Opcode();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1060
    if (xop == Op_MemBarRelease || xop == Op_MemBarVolatile) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1061
      // Make sure we're not missing Call/Phi/MergeMem by checking
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1062
      // control edges. The control edge must directly lead back
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1063
      // to the MemBarAcquire
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1064
      Node *ctrl_proj = x->in(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1065
      if (ctrl_proj->is_Proj() && ctrl_proj->in(0) == mba) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1066
        return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1067
      }
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
  }
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
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1072
}
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
#define __ _masm.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1075
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1076
// Tertiary op of a LoadP or StoreP encoding.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1077
#define REGP_OP true
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1078
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1079
// ****************************************************************************
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1080
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1081
// REQUIRED FUNCTIONALITY
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1082
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1083
// !!!!! 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
  1084
//       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
  1085
//       will point.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1086
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1087
// PPC port: Removed use of lazy constant construct.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1088
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1089
int MachCallStaticJavaNode::ret_addr_offset() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1090
  // It's only a single branch-and-link instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1091
  return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1092
}
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
int MachCallDynamicJavaNode::ret_addr_offset() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1095
  // 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
  1096
  // 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
  1097
  if (UseInlineCaches)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1098
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1099
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1100
  int vtable_index = this->_vtable_index;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1101
  if (vtable_index < 0) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1102
    // Must be invalid_vtable_index, not nonvirtual_vtable_index.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1103
    assert(vtable_index == Method::invalid_vtable_index, "correct sentinel value");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1104
    return 12;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1105
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1106
    assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1107
    return 24;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1108
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1109
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1110
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1111
int MachCallRuntimeNode::ret_addr_offset() {
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  1112
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  1113
  return 28;
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  1114
#else
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1115
  return 40;
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  1116
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1117
}
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
// condition code conversions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1122
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1123
static int cc_to_boint(int cc) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1124
  return Assembler::bcondCRbiIs0 | (cc & 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1125
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1126
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1127
static int cc_to_inverse_boint(int cc) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1128
  return Assembler::bcondCRbiIs0 | (8-(cc & 8));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1129
}
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
static int cc_to_biint(int cc, int flags_reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1132
  return (flags_reg << 2) | (cc & 3);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1135
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1136
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1137
// Compute padding required for nodes which need alignment. The padding
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1138
// is the number of bytes (not instructions) which will be inserted before
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1139
// the instruction. The padding must match the size of a NOP instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1140
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  1141
// Currently not used on this platform.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1142
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1143
//=============================================================================
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
// Indicate if the safepoint node needs the polling page as an input.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1146
bool SafePointNode::needs_polling_address_input() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1147
  // The address is loaded from thread by a seperate node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1148
  return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1149
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1150
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1151
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1152
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1153
// Emit an interrupt that is caught by the debugger (for debugging compiler).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1154
void emit_break(CodeBuffer &cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1155
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1156
  __ illtrap();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1157
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1158
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1159
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1160
void MachBreakpointNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1161
  st->print("BREAKPOINT");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1162
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1163
#endif
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
void MachBreakpointNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1166
  emit_break(cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1167
}
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
uint MachBreakpointNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1170
  return MachNode::size(ra_);
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
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1174
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1175
void emit_nop(CodeBuffer &cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1176
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1177
  __ nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1178
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1179
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1180
static inline void emit_long(CodeBuffer &cbuf, int value) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1181
  *((int*)(cbuf.insts_end())) = value;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1182
  cbuf.set_insts_end(cbuf.insts_end() + BytesPerInstWord);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1183
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1184
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1185
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1186
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1187
%} // interrupt source
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1188
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1189
source_hpp %{ // Header information of the source block.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1190
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1191
//--------------------------------------------------------------
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1192
//---<  Used for optimization in Compile::Shorten_branches  >---
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1193
//--------------------------------------------------------------
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1194
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1195
class CallStubImpl {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1196
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1197
 public:
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1198
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  1199
  // Emit call stub, compiled java to interpreter.
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1200
  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
  1201
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1202
  // Size of call trampoline stub.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1203
  // 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
  1204
  // 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
  1205
  static uint size_call_trampoline() {
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  1206
    return MacroAssembler::trampoline_stub_size;
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1207
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1208
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1209
  // 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
  1210
  static uint reloc_call_trampoline() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1211
    return 5;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1212
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1213
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1214
};
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1215
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1216
%} // end source_hpp
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1217
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1218
source %{
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1219
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1220
// 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
  1221
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1222
// code sequences:
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
// call-site:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1225
//   branch-and-link to <destination> or <trampoline stub>
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1226
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1227
// Related trampoline stub for this call-site in the stub section:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1228
//   load the call target from the constant pool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1229
//   branch via CTR (LR/link still points to the call-site above)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1230
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  1231
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
  1232
  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
  1233
  if (stub == NULL) {
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  1234
    ciEnv::current()->record_out_of_memory_failure();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1235
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1236
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1237
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
// Emit an inline branch-and-link call and a related trampoline stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1241
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1242
// code sequences:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1243
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1244
// call-site:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1245
//   branch-and-link to <destination> or <trampoline stub>
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1246
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1247
// Related trampoline stub for this call-site in the stub section:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1248
//   load the call target from the constant pool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1249
//   branch via CTR (LR/link still points to the call-site above)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1250
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1251
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1252
typedef struct {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1253
  int insts_call_instruction_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1254
  int ret_addr_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1255
} EmitCallOffsets;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1256
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1257
// Emit a branch-and-link instruction that branches to a trampoline.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1258
// - Remember the offset of the branch-and-link instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1259
// - Add a relocation at the branch-and-link instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1260
// - Emit a branch-and-link.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1261
// - Remember the return pc offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1262
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
  1263
  EmitCallOffsets offsets = { -1, -1 };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1264
  const int start_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1265
  offsets.insts_call_instruction_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1266
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1267
  // No entry point given, use the current pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1268
  if (entry_point == NULL) entry_point = __ pc();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1269
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1270
  // Put the entry point as a constant into the constant pool.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1271
  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
  1272
  if (entry_point_toc_addr == NULL) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1273
    ciEnv::current()->record_out_of_memory_failure();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1274
    return offsets;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1275
  }
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1276
  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
  1277
  
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1278
  // 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
  1279
  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
  1280
  if (ciEnv::current()->failing()) { return offsets; } // Code cache may be full.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1281
  __ relocate(rtype);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  1282
  
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1283
  // 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
  1284
  // 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
  1285
  // serves as dummy and the bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1286
  __ bl((address) __ pc());
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
  offsets.ret_addr_offset = __ offset() - start_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1289
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1290
  return offsets;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1291
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1292
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1293
//=============================================================================
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
// Factory for creating loadConL* nodes for large/small constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1296
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1297
static inline jlong replicate_immF(float con) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1298
  // Replicate float con 2 times and pack into vector.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1299
  int val = *((int*)&con);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1300
  jlong lval = val;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1301
  lval = (lval << 32) | (lval & 0xFFFFFFFFl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1302
  return lval;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1305
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1306
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1307
const RegMask& MachConstantBaseNode::_out_RegMask = BITS64_CONSTANT_TABLE_BASE_mask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1308
int Compile::ConstantTable::calculate_table_base_offset() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1309
  return 0;  // absolute addressing, no offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1310
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1311
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1312
bool MachConstantBaseNode::requires_postalloc_expand() const { return true; }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1313
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
  1314
  iRegPdstOper *op_dst = new iRegPdstOper();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  1315
  MachNode *m1 = new loadToc_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  1316
  MachNode *m2 = new loadToc_loNode();
22861
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
  m1->add_req(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1319
  m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1320
  m1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1321
  m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1322
  m2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1323
  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
  1324
  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
  1325
  nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1326
  nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1327
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1328
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1329
void MachConstantBaseNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1330
  // Is postalloc expanded.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1331
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1332
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1333
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1334
uint MachConstantBaseNode::size(PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1335
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1336
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1337
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1338
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1339
void MachConstantBaseNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1340
  st->print("-- \t// MachConstantBaseNode (empty encoding)");
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
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1343
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1344
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1345
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1346
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1347
void MachPrologNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1348
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1349
  const long framesize = C->frame_slots() << LogBytesPerInt;
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
  st->print("PROLOG\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1352
  if (C->need_stack_bang(framesize)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1353
    st->print("stack_overflow_check\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1354
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1355
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1356
  if (!false /* TODO: PPC port C->is_frameless_method()*/) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1357
    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
  1358
    st->print("push frame %ld\n\t", -framesize);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1359
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1360
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1361
#endif
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
// Macro used instead of the common __ to emulate the pipes of PPC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1364
// 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
  1365
// 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
  1366
// 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
  1367
// 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
  1368
// 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
  1369
// 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
  1370
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1371
#define ___(op) if (UsePower6SchedulerPPC64 && C->hb_scheduling())                    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1372
                  C->hb_scheduling()->_pdScheduling->PdEmulatePipe(ppc64Opcode_##op); \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1373
                _masm.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1374
#define ___stop if (UsePower6SchedulerPPC64 && C->hb_scheduling())                    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1375
                  C->hb_scheduling()->_pdScheduling->PdEmulatePipe(archOpcode_none)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1376
#define ___advance if (UsePower6SchedulerPPC64 && C->hb_scheduling())                 \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1377
                  C->hb_scheduling()->_pdScheduling->advance_offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1378
#else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1379
#define ___(op) if (UsePower6SchedulerPPC64)                                          \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1380
                  Unimplemented();                                                    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1381
                _masm.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1382
#define ___stop if (UsePower6SchedulerPPC64)                                          \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1383
                  Unimplemented()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1384
#define ___advance if (UsePower6SchedulerPPC64)                                       \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1385
                  Unimplemented()
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1386
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1387
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1388
void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1389
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1390
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1391
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1392
  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
  1393
  assert(framesize % (2 * wordSize) == 0, "must preserve 2*wordSize alignment");
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1394
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1395
  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
  1396
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1397
  const Register return_pc            = R20; // Must match return_addr() in frame section.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1398
  const Register callers_sp           = R21;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1399
  const Register push_frame_temp      = R22;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1400
  const Register toc_temp             = R23;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1401
  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
  1402
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1403
  if (method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1404
    // Add nop at beginning of all frameless methods to prevent any
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1405
    // oop instructions from getting overwritten by make_not_entrant
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1406
    // (patching attempt would fail).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1407
    ___(nop) nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1408
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1409
    // Get return pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1410
    ___(mflr) mflr(return_pc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1411
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1412
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1413
  // Calls to C2R adapters often do not accept exceptional returns.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1414
  // We require that their callers must bang for them. But be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1415
  // careful, because some VM calls (such as call site linkage) can
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1416
  // use several kilobytes of stack. But the stack safety zone should
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1417
  // 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
  1418
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1419
  int bangsize = C->bang_size_in_bytes();
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1420
  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
  1421
  if (C->need_stack_bang(bangsize) && UseStackBanging) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1422
    // Unfortunately we cannot use the function provided in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1423
    // 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
  1424
    // insert the code of generate_stack_overflow_check(), see
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1425
    // assembler.cpp for some illuminative comments.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1426
    const int page_size = os::vm_page_size();
35201
996db89f378e 8139864: Improve handling of stack protection zones.
goetz
parents: 34185
diff changeset
  1427
    int bang_end = JavaThread::stack_shadow_zone_size();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1428
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1429
    // This is how far the previous frame's stack banging extended.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1430
    const int bang_end_safe = bang_end;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1431
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1432
    if (bangsize > page_size) {
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents: 23498
diff changeset
  1433
      bang_end += bangsize;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1434
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1435
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1436
    int bang_offset = bang_end_safe;
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
    while (bang_offset <= bang_end) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1439
      // Need at least one stack bang at end of shadow zone.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1440
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  1441
      // 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
  1442
      // bang_stack_with_offset - see there for comments.
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
      // Stack grows down, caller passes positive offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1445
      assert(bang_offset > 0, "must bang with positive offset");
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
      long stdoffset = -bang_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1448
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1449
      if (Assembler::is_simm(stdoffset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1450
        // Signed 16 bit offset, a simple std is ok.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1451
        if (UseLoadInstructionsForStackBangingPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1452
          ___(ld) ld(R0,  (int)(signed short)stdoffset, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1453
        } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1454
          ___(std) std(R0, (int)(signed short)stdoffset, R1_SP);
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
      } else if (Assembler::is_simm(stdoffset, 31)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1457
        // Use largeoffset calculations for addis & ld/std.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1458
        const int hi = MacroAssembler::largeoffset_si16_si16_hi(stdoffset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1459
        const int lo = MacroAssembler::largeoffset_si16_si16_lo(stdoffset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1460
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1461
        Register tmp = R11;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1462
        ___(addis) addis(tmp, R1_SP, hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1463
        if (UseLoadInstructionsForStackBangingPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1464
          ___(ld) ld(R0, lo, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1465
        } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1466
          ___(std) std(R0, lo, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1467
        }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1468
      } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1469
        ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1470
      }
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
      bang_offset += page_size;
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
    // R11 trashed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1475
  } // C->need_stack_bang(framesize) && UseStackBanging
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1476
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1477
  unsigned int bytes = (unsigned int)framesize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1478
  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
  1479
  ciMethod *currMethod = C->method();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1480
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1481
  // Optimized version for most common case.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1482
  if (UsePower6SchedulerPPC64 &&
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1483
      !method_is_frameless && Assembler::is_simm((int)(-offset), 16) &&
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1484
      !(false /* ConstantsALot TODO: PPC port*/)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1485
    ___(or) mr(callers_sp, R1_SP);
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1486
    ___(std) std(return_pc, _abi(lr), R1_SP);
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1487
    ___(stdu) stdu(R1_SP, -offset, R1_SP);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1488
    return;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1489
  }
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
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1492
    // Get callers sp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1493
    ___(or) mr(callers_sp, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1494
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1495
    // Push method's frame, modifies SP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1496
    assert(Assembler::is_uimm(framesize, 32U), "wrong type");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1497
    // The ABI is already accounted for in 'framesize' via the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1498
    // 'out_preserve' area.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1499
    Register tmp = push_frame_temp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1500
    // 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
  1501
    if (Assembler::is_simm(-offset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1502
      ___(stdu) stdu(R1_SP, -offset, R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1503
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1504
      long x = -offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1505
      // Had to insert load_const(tmp, -offset).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1506
      ___(addis)  lis( tmp, (int)((signed short)(((x >> 32) & 0xffff0000) >> 16)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1507
      ___(ori)    ori( tmp, tmp, ((x >> 32) & 0x0000ffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1508
      ___(rldicr) sldi(tmp, tmp, 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1509
      ___(oris)   oris(tmp, tmp, (x & 0xffff0000) >> 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1510
      ___(ori)    ori( tmp, tmp, (x & 0x0000ffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1511
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1512
      ___(stdux) stdux(R1_SP, R1_SP, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1513
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1514
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1515
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1516
  // 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
  1517
  // "Randomize" const_size.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1518
  if (ConstantsALot) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1519
    const int num_consts = const_size();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1520
    for (int i = 0; i < num_consts; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1521
      __ long_constant(0xB0B5B00BBABE);
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
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1524
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1525
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1526
    // Save return pc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1527
    ___(std) std(return_pc, _abi(lr), callers_sp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1528
  }
38228
6dbbdb9ee00e 8155738: C2: fix frame_complete_offset
goetz
parents: 38049
diff changeset
  1529
  
6dbbdb9ee00e 8155738: C2: fix frame_complete_offset
goetz
parents: 38049
diff changeset
  1530
  C->set_frame_complete(cbuf.insts_size());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1531
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1532
#undef ___
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1533
#undef ___stop
22867
309bcf262a19 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 22865
diff changeset
  1534
#undef ___advance
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1535
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1536
uint MachPrologNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1537
  // Variable size. determine dynamically.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1538
  return MachNode::size(ra_);
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
int MachPrologNode::reloc() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1542
  // Return number of relocatable values contained in this instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1543
  return 1; // 1 reloc entry for load_const(toc).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1544
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1545
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1546
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1547
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1548
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1549
void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1550
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1551
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1552
  st->print("EPILOG\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1553
  st->print("restore return pc\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1554
  st->print("pop frame\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1555
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1556
  if (do_polling() && C->is_method_compilation()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1557
    st->print("touch polling page\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1558
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1559
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1560
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1561
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1562
void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1563
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1564
  MacroAssembler _masm(&cbuf);
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
  const long framesize = ((long)C->frame_slots()) << LogBytesPerInt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1567
  assert(framesize >= 0, "negative frame-size?");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1568
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1569
  const bool method_needs_polling = do_polling() && C->is_method_compilation();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1570
  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
  1571
  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
  1572
  const Register polling_page     = R12;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1573
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1574
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1575
    // Restore return pc relative to callers' sp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1576
    __ ld(return_pc, ((int)framesize) + _abi(lr), R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1577
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1578
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1579
  if (method_needs_polling) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1580
    if (LoadPollAddressFromThread) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1581
      // 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
  1582
      Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1583
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1584
      __ 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
  1585
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1586
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1587
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1588
  if (!method_is_frameless) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1589
    // Move return pc to LR.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1590
    __ mtlr(return_pc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1591
    // Pop frame (fixed frame-size).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1592
    __ addi(R1_SP, R1_SP, (int)framesize);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1593
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1594
38931
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
  1595
  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
  1596
    __ reserved_stack_check(return_pc);
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
  1597
  }
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
  1598
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1599
  if (method_needs_polling) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1600
    // 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
  1601
    // polling page was emitted as relocInfo::poll_return_type here.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1602
    __ relocate(relocInfo::poll_return_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1603
    __ load_from_polling_page(polling_page);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1604
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1605
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1606
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1607
uint MachEpilogNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1608
  // Variable size. Determine dynamically.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1609
  return MachNode::size(ra_);
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
int MachEpilogNode::reloc() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1613
  // Return number of relocatable values contained in this instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1614
  return 1; // 1 for load_from_polling_page.
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1617
const Pipeline * MachEpilogNode::pipeline() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1618
  return MachNode::pipeline_class();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1619
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1620
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1621
// This method seems to be obsolete. It is declared in machnode.hpp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1622
// 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
  1623
// get rid of it?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1624
int MachEpilogNode::safepoint_offset() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1625
  assert(do_polling(), "no return for this epilog node");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1626
  return 0;
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
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1630
void MachLoadPollAddrLateNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1631
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1632
  if (LoadPollAddressFromThread) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1633
    _masm.ld(R11, in_bytes(JavaThread::poll_address_offset()), R16_thread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1634
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1635
    _masm.nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1636
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1637
}
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
uint MachLoadPollAddrLateNode::size(PhaseRegAlloc* ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1640
  if (LoadPollAddressFromThread) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1641
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1642
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1643
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1644
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1645
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1646
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1647
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1648
void MachLoadPollAddrLateNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1649
  st->print_cr(" LD R11, PollAddressOffset, R16_thread \t// LoadPollAddressFromThread");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1650
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1651
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1652
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1653
const RegMask &MachLoadPollAddrLateNode::out_RegMask() const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1654
  return RSCRATCH1_BITS64_REG_mask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1655
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1656
#endif // PPC port
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
// =============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1659
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1660
// 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
  1661
// rc_stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1662
enum RC { rc_bad, rc_int, rc_float, rc_stack };
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1663
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1664
static enum RC rc_class(OptoReg::Name reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1665
  // Return the register class for the given register. The given register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1666
  // 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
  1667
  // enumeration in adGlobals_ppc.hpp.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1668
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1669
  if (reg == OptoReg::Bad) return rc_bad;
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
  // We have 64 integer register halves, starting at index 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1672
  if (reg < 64) return rc_int;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1673
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1674
  // We have 64 floating-point register halves, starting at index 64.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1675
  if (reg < 64+64) return rc_float;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1676
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1677
  // Between float regs & stack are the flags regs.
47594
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
  1678
  assert(OptoReg::is_stack(reg) || reg < 64+64+64, "blow up if spilling flags");
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1679
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1680
  return rc_stack;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1681
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1682
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1683
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
  1684
                        bool do_print, Compile* C, outputStream *st) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1685
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1686
  assert(opcode == Assembler::LD_OPCODE   ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1687
         opcode == Assembler::STD_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1688
         opcode == Assembler::LWZ_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1689
         opcode == Assembler::STW_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1690
         opcode == Assembler::LFD_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1691
         opcode == Assembler::STFD_OPCODE ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1692
         opcode == Assembler::LFS_OPCODE  ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1693
         opcode == Assembler::STFS_OPCODE,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1694
         "opcode not supported");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1695
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1696
  if (cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1697
    int d =
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1698
      (Assembler::LD_OPCODE == opcode || Assembler::STD_OPCODE == opcode) ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1699
        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
  1700
      : 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
  1701
    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
  1702
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1703
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1704
  else if (do_print) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1705
    st->print("%-7s %s, [R1_SP + #%d+%d] \t// spill copy",
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1706
              op_str,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1707
              Matcher::regName[reg],
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1708
              offset, 0 /* TODO: PPC port C->frame_slots_sp_bias_in_bytes()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1709
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1710
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1711
  return 4; // size
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1712
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1713
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1714
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
  1715
  Compile* C = ra_->C;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1716
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1717
  // Get registers to move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1718
  OptoReg::Name src_hi = ra_->get_reg_second(in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1719
  OptoReg::Name src_lo = ra_->get_reg_first(in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1720
  OptoReg::Name dst_hi = ra_->get_reg_second(this);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1721
  OptoReg::Name dst_lo = ra_->get_reg_first(this);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1722
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1723
  enum RC src_hi_rc = rc_class(src_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1724
  enum RC src_lo_rc = rc_class(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1725
  enum RC dst_hi_rc = rc_class(dst_hi);
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
  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
  1729
  if (src_hi != OptoReg::Bad)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1730
    assert((src_lo&1)==0 && src_lo+1==src_hi &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1731
           (dst_lo&1)==0 && dst_lo+1==dst_hi,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1732
           "expected aligned-adjacent pairs");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1733
  // Generate spill code!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1734
  int size = 0;
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
  if (src_lo == dst_lo && src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1737
    return size;            // Self copy, no move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1738
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1739
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1740
  // Memory->Memory Spill. Use R0 to hold the value.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1741
  if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1742
    int src_offset = ra_->reg2offset(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1743
    int dst_offset = ra_->reg2offset(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1744
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1745
      assert(src_hi_rc==rc_stack && dst_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1746
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1747
      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
  1748
      if (!cbuf && !do_size) st->print("\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1749
      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
  1750
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1751
      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
  1752
      if (!cbuf && !do_size) st->print("\n\t");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1753
      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
  1754
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1755
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1756
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1757
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1758
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1759
  // Check for float->int copy; requires a trip through memory.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1760
  if (src_lo_rc == rc_float && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1761
    Unimplemented();
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
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1765
  // Check for integer reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1766
  if (src_lo_rc == rc_int && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1767
      Register Rsrc = as_Register(Matcher::_regEncode[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1768
      Register Rdst = as_Register(Matcher::_regEncode[dst_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1769
      size = (Rsrc != Rdst) ? 4 : 0;
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
      if (cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1772
        MacroAssembler _masm(cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1773
        if (size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1774
          __ mr(Rdst, Rsrc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1775
        }
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
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1778
      else if (!do_size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1779
        if (size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1780
          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
  1781
        } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1782
          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
  1783
        }
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
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1786
      return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1787
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1788
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1789
  // Check for integer store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1790
  if (src_lo_rc == rc_int && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1791
    int dst_offset = ra_->reg2offset(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1792
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1793
      assert(src_hi_rc==rc_int && dst_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1794
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1795
      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
  1796
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1797
      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
  1798
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1799
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1800
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1801
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1802
  // Check for integer load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1803
  if (dst_lo_rc == rc_int && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1804
    int src_offset = ra_->reg2offset(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1805
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1806
      assert(dst_hi_rc==rc_int && src_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1807
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1808
      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
  1809
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1810
      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
  1811
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1812
    return size;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1815
  // Check for float reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1816
  if (src_lo_rc == rc_float && dst_lo_rc == rc_float) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1817
    if (cbuf) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1818
      MacroAssembler _masm(cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1819
      FloatRegister Rsrc = as_FloatRegister(Matcher::_regEncode[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1820
      FloatRegister Rdst = as_FloatRegister(Matcher::_regEncode[dst_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1821
      __ fmr(Rdst, Rsrc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1822
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1823
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1824
    else if (!do_size) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1825
      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
  1826
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1827
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1828
    return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1829
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1830
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1831
  // Check for float store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1832
  if (src_lo_rc == rc_float && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1833
    int dst_offset = ra_->reg2offset(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1834
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1835
      assert(src_hi_rc==rc_float && dst_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1836
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1837
      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
  1838
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1839
      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
  1840
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1841
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1842
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1843
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1844
  // Check for float load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1845
  if (dst_lo_rc == rc_float && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1846
    int src_offset = ra_->reg2offset(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1847
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1848
      assert(dst_hi_rc==rc_float && src_hi_rc==rc_stack,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1849
             "expected same type of move for high parts");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1850
      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
  1851
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1852
      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
  1853
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1854
    return size;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1855
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1856
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
  // Check for hi bits still needing moving. Only happens for misaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1859
  // arguments to native calls.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1860
  if (src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1861
    return size;               // Self copy; no move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1862
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1863
  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
  1864
  ShouldNotReachHere(); // Unimplemented
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1865
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1866
}
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
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1869
void MachSpillCopyNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1870
  if (!ra_)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1871
    st->print("N%d = SpillCopy(N%d)", _idx, in(1)->_idx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1872
  else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1873
    implementation(NULL, ra_, false, st);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1874
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1875
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1876
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1877
void MachSpillCopyNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1878
  implementation(&cbuf, ra_, false, NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1879
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1880
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1881
uint MachSpillCopyNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1882
  return implementation(NULL, ra_, true, NULL);
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
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1886
ArchOpcode MachSpillCopyNode_archOpcode(MachSpillCopyNode *n, PhaseRegAlloc *ra_) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1887
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1888
  if (ra_->node_regs_max_index() == 0) return archOpcode_undefined;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1889
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1890
  assert(ra_->node_regs_max_index() != 0, "");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1891
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1892
  // Get registers to move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1893
  OptoReg::Name src_hi = ra_->get_reg_second(n->in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1894
  OptoReg::Name src_lo = ra_->get_reg_first(n->in(1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1895
  OptoReg::Name dst_hi = ra_->get_reg_second(n);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1896
  OptoReg::Name dst_lo = ra_->get_reg_first(n);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1897
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1898
  enum RC src_lo_rc = rc_class(src_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1899
  enum RC dst_lo_rc = rc_class(dst_lo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1900
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1901
  if (src_lo == dst_lo && src_hi == dst_hi)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1902
    return ppc64Opcode_none;            // Self copy, no move.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1903
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1904
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1905
  // Memory->Memory Spill. Use R0 to hold the value.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1906
  if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1907
    return ppc64Opcode_compound;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1908
  }
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
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1911
  // Check for float->int copy; requires a trip through memory.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1912
  if (src_lo_rc == rc_float && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1913
    Unimplemented();
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
  // --------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1917
  // Check for integer reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1918
  if (src_lo_rc == rc_int && dst_lo_rc == rc_int) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1919
    Register Rsrc = as_Register(Matcher::_regEncode[src_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1920
    Register Rdst = as_Register(Matcher::_regEncode[dst_lo]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1921
    if (Rsrc == Rdst) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1922
      return ppc64Opcode_none;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1923
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1924
      return ppc64Opcode_or;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1925
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1926
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1927
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1928
  // Check for integer store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1929
  if (src_lo_rc == rc_int && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1930
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1931
      return ppc64Opcode_std;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1932
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1933
      return ppc64Opcode_stw;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1934
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1935
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1936
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1937
  // Check for integer load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1938
  if (dst_lo_rc == rc_int && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1939
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1940
      return ppc64Opcode_ld;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1941
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1942
      return ppc64Opcode_lwz;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1943
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1944
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1945
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1946
  // Check for float reg-reg copy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1947
  if (src_lo_rc == rc_float && dst_lo_rc == rc_float) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1948
    return ppc64Opcode_fmr;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1951
  // Check for float store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1952
  if (src_lo_rc == rc_float && dst_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1953
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1954
      return ppc64Opcode_stfd;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1955
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1956
      return ppc64Opcode_stfs;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1960
  // Check for float load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1961
  if (dst_lo_rc == rc_float && src_lo_rc == rc_stack) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1962
    if (src_hi != OptoReg::Bad) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1963
      return ppc64Opcode_lfd;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1964
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1965
      return ppc64Opcode_lfs;
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
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1968
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1969
  // --------------------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1970
  // Check for hi bits still needing moving. Only happens for misaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1971
  // arguments to native calls.
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1972
  if (src_hi == dst_hi) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1973
    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
  1974
  }
22861
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
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1977
  return ppc64Opcode_undefined;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1978
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1979
#endif // PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1980
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1981
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1982
void MachNopNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1983
  st->print("NOP \t// %d nops to pad for loops.", _count);
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
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1986
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1987
void MachNopNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1988
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1989
  // _count contains the number of nops needed for padding.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1990
  for (int i = 0; i < _count; i++) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1991
    __ nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1992
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1993
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1994
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1995
uint MachNopNode::size(PhaseRegAlloc *ra_) const {
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1996
  return _count * 4;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1997
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1998
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  1999
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2000
void BoxLockNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2001
  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
  2002
  char reg_str[128];
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  2003
  ra_->dump_register(this, reg_str);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  2004
  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
  2005
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2006
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2007
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2008
void BoxLockNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2009
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2010
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2011
  int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2012
  int reg    = ra_->get_encode(this);
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
  if (Assembler::is_simm(offset, 16)) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2015
    __ addi(as_Register(reg), R1, offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2016
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2017
    ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2018
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2019
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2020
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2021
uint BoxLockNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2022
  // 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
  2023
  return 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2024
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2025
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2026
#ifndef PRODUCT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2027
void MachUEPNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2028
  st->print_cr("---- MachUEPNode ----");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2029
  st->print_cr("...");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2030
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2031
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2032
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2033
void MachUEPNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2034
  // This is the unverified entry point.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2035
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2036
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2037
  // Inline_cache contains a klass.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2038
  Register ic_klass       = as_Register(Matcher::inline_cache_reg_encode());
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  2039
  Register receiver_klass = R12_scratch2;  // tmp
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2040
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2041
  assert_different_registers(ic_klass, receiver_klass, R11_scratch1, R3_ARG1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2042
  assert(R11_scratch1 == R11, "need prologue scratch register");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2043
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2044
  // Check for NULL argument if we don't have implicit null checks.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2045
  if (!ImplicitNullChecks || !os::zero_page_read_protected()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2046
    if (TrapBasedNullChecks) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2047
      __ trap_null_check(R3_ARG1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2048
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2049
      Label valid;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2050
      __ cmpdi(CCR0, R3_ARG1, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2051
      __ bne_predict_taken(CCR0, valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2052
      // We have a null argument, branch to ic_miss_stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2053
      __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2054
                           relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2055
      __ bind(valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2056
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2057
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2058
  // Assume argument is not NULL, load klass from receiver.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2059
  __ load_klass(receiver_klass, R3_ARG1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2060
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2061
  if (TrapBasedICMissChecks) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2062
    __ trap_ic_miss_check(receiver_klass, ic_klass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2063
  } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2064
    Label valid;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2065
    __ cmpd(CCR0, receiver_klass, ic_klass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2066
    __ beq_predict_taken(CCR0, valid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2067
    // We have an unexpected klass, branch to ic_miss_stub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2068
    __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2069
                         relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2070
    __ bind(valid);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2073
  // Argument is valid and klass is as expected, continue.
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
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2077
// 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
  2078
int MachUEPNode::ep_offset() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2079
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2080
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2081
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2082
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2083
uint MachUEPNode::size(PhaseRegAlloc *ra_) const {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2084
  // Variable size. Determine dynamically.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2085
  return MachNode::size(ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2086
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2087
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
23498
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2090
%} // interrupt source
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2091
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2092
source_hpp %{ // Header information of the source block.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2093
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2094
class HandlerImpl {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2095
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2096
 public:
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2097
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2098
  static int emit_exception_handler(CodeBuffer &cbuf);
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2099
  static int emit_deopt_handler(CodeBuffer& cbuf);
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2100
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2101
  static uint size_exception_handler() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2102
    // The exception_handler is a b64_patchable.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2103
    return MacroAssembler::b64_patchable_size;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2104
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2105
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2106
  static uint size_deopt_handler() {
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2107
    // The deopt_handler is a bl64_patchable.
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2108
    return MacroAssembler::bl64_patchable_size;
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2109
  }
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2110
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2111
};
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2112
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2113
%} // end source_hpp
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2114
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2115
source %{
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2116
a0e67b766e5c 8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents: 23492
diff changeset
  2117
int HandlerImpl::emit_exception_handler(CodeBuffer &cbuf) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2118
  MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2119
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2120
  address base = __ start_a_stub(size_exception_handler());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2121
  if (base == NULL) return 0; // CodeBuffer::expand failed
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
  int offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2124
  __ b64_patchable((address)OptoRuntime::exception_blob()->content_begin(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2125
                       relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2126
  assert(__ offset() - offset == (int)size_exception_handler(), "must be fixed size");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2127
  __ end_a_stub();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2128
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2129
  return offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2130
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2131
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2132
// The deopt_handler is like the exception handler, but it calls to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2133
// 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
  2134
int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2135
  MacroAssembler _masm(&cbuf);
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
  address base = __ start_a_stub(size_deopt_handler());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2138
  if (base == NULL) return 0; // CodeBuffer::expand failed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2139
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2140
  int offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2141
  __ bl64_patchable((address)SharedRuntime::deopt_blob()->unpack(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2142
                        relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2143
  assert(__ offset() - offset == (int) size_deopt_handler(), "must be fixed size");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2144
  __ end_a_stub();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2145
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2146
  return offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2147
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2148
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2149
//=============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2150
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2151
// Use a frame slots bias for frameless methods if accessing the stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2152
static int frame_slots_bias(int reg_enc, PhaseRegAlloc* ra_) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2153
  if (as_Register(reg_enc) == R1_SP) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2154
    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
  2155
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2156
  return 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2157
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2158
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2159
const bool Matcher::match_rule_supported(int opcode) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2160
  if (!has_match_rule(opcode))
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
  switch (opcode) {
22879
177361c49b26 8035394: PPC64: Make usage of intrinsic dsqrt depend on processor recognition.
goetz
parents: 22874
diff changeset
  2164
  case Op_SqrtD:
177361c49b26 8035394: PPC64: Make usage of intrinsic dsqrt depend on processor recognition.
goetz
parents: 22874
diff changeset
  2165
    return VM_Version::has_fsqrt();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2166
  case Op_CountLeadingZerosI:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2167
  case Op_CountLeadingZerosL:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2168
  case Op_CountTrailingZerosI:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2169
  case Op_CountTrailingZerosL:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2170
    if (!UseCountLeadingZerosInstructionsPPC64)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2171
      return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2172
    break;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2173
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2174
  case Op_PopCountI:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2175
  case Op_PopCountL:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2176
    return (UsePopCountInstruction && VM_Version::has_popcntw());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2177
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2178
  case Op_StrComp:
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
  2179
    return SpecialStringCompareTo;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2180
  case Op_StrEquals:
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
  2181
    return SpecialStringEquals;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2182
  case Op_StrIndexOf:
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
  2183
    return SpecialStringIndexOf;
35581
dd47cf4734f2 8145336: PPC64: fix string intrinsics after CompactStrings change
simonis
parents: 35232
diff changeset
  2184
  case Op_StrIndexOfChar:
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
  2185
    return SpecialStringIndexOf;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2186
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2187
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2188
  return true;  // Per default match rules are supported.
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
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2191
const bool Matcher::match_rule_supported_vector(int opcode, int vlen) {
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2192
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2193
  // TODO
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2194
  // identify extra cases that we might want to provide match rules for
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2195
  // e.g. Op_ vector nodes and other intrinsics while guarding with vlen
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2196
  bool ret_value = match_rule_supported(opcode);
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2197
  // Add rules here.
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2198
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2199
  return ret_value;  // Per default match rules are supported.
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2200
}
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  2201
38049
e8541793960f 8153998: Masked vector post loops
mcberg
parents: 36554
diff changeset
  2202
const bool Matcher::has_predicated_vectors(void) {
e8541793960f 8153998: Masked vector post loops
mcberg
parents: 36554
diff changeset
  2203
  return false;
e8541793960f 8153998: Masked vector post loops
mcberg
parents: 36554
diff changeset
  2204
}
e8541793960f 8153998: Masked vector post loops
mcberg
parents: 36554
diff changeset
  2205
33065
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 32082
diff changeset
  2206
const int Matcher::float_pressure(int default_pressure_threshold) {
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 32082
diff changeset
  2207
  return default_pressure_threshold;
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 32082
diff changeset
  2208
}
55892792936f 8134802: LCM register pressure scheduling
mcberg
parents: 32082
diff changeset
  2209
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2210
int Matcher::regnum_to_fpu_offset(int regnum) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2211
  // No user for this method?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2212
  Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2213
  return 999;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2214
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2215
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2216
const bool Matcher::convL2FSupported(void) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2217
  // fcfids can do the conversion (>= Power7).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2218
  // fcfid + frsp showed rounding problem when result should be 0x3f800001.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2219
  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
  2220
}
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
// Vector width in bytes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2223
const int Matcher::vector_width_in_bytes(BasicType bt) {
47594
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
  2224
  if (SuperwordUseVSX) {
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2225
    assert(MaxVectorSize == 16, "");
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2226
    return 16;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2227
  } else {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2228
    assert(MaxVectorSize == 8, "");
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2229
    return 8;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2230
  }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2231
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2232
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2233
// Vector ideal reg.
46378
4ccca1fdf627 8160748: Inconsistent types for ideal_reg
kbarrett
parents: 42884
diff changeset
  2234
const uint Matcher::vector_ideal_reg(int size) {
47594
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
  2235
  if (SuperwordUseVSX) {
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2236
    assert(MaxVectorSize == 16 && size == 16, "");
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2237
    return Op_VecX;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2238
  } else {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2239
    assert(MaxVectorSize == 8 && size == 8, "");
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2240
    return Op_RegL;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2241
  }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2242
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2243
46378
4ccca1fdf627 8160748: Inconsistent types for ideal_reg
kbarrett
parents: 42884
diff changeset
  2244
const uint Matcher::vector_shift_count_ideal_reg(int size) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2245
  fatal("vector shift is not supported");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2246
  return Node::NotAMachineReg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2247
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2248
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2249
// Limits on vector size (number of elements) loaded into vector.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2250
const int Matcher::max_vector_size(const BasicType bt) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2251
  assert(is_java_primitive(bt), "only primitive type vectors");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2252
  return vector_width_in_bytes(bt)/type2aelembytes(bt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2253
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2254
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2255
const int Matcher::min_vector_size(const BasicType bt) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2256
  return max_vector_size(bt); // Same as max.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2257
}
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
// PPC doesn't support misaligned vectors store/load.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2260
const bool Matcher::misaligned_vectors_ok() {
47594
fd0db78ac8d4 8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
mhorie
parents: 47584
diff changeset
  2261
  return !AlignVector; // can be changed by flag
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2262
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2263
22874
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2264
// PPC AES support not yet implemented
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2265
const bool Matcher::pass_original_key_for_aes() {
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2266
  return false;
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2267
}
9918cae8623d 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 22867
diff changeset
  2268
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2269
// RETURNS: whether this branch offset is short enough that a short
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2270
// branch can be used.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2271
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2272
// If the platform does not provide any short branch variants, then
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2273
// this method should return `false' for offset 0.
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
// `Compile::Fill_buffer' will decide on basis of this information
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2276
// whether to do the pass `Compile::Shorten_branches' at all.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2277
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2278
// And `Compile::Shorten_branches' will decide on basis of this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2279
// information whether to replace particular branch sites by short
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2280
// ones.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2281
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
  2282
  // Is the offset within the range of a ppc64 pc relative branch?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2283
  bool b;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2284
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2285
  const int safety_zone = 3 * BytesPerInstWord;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2286
  b = Assembler::is_simm((offset<0 ? offset-safety_zone : offset+safety_zone),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2287
                         29 - 16 + 1 + 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2288
  return b;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2289
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2290
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2291
const bool Matcher::isSimpleConstant64(jlong value) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2292
  // Probably always true, even if a temp register is required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2293
  return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2294
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2295
/* TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2296
// Make a new machine dependent decode node (with its operands).
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  2297
MachTypeNode *Matcher::make_decode_node() {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2298
  assert(Universe::narrow_oop_base() == NULL && Universe::narrow_oop_shift() == 0,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2299
         "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
  2300
  MachTypeNode *decode = new decodeN_unscaledNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2301
  decode->set_opnd_array(0, new iRegPdstOper());
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2302
  decode->set_opnd_array(1, new iRegNsrcOper());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2303
  return decode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2304
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2305
*/
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2306
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2307
// false => size gets scaled to BytesPerLong, ok.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2308
const bool Matcher::init_array_count_is_in_bytes = false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2309
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2310
// Use conditional move (CMOVL) on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2311
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
  2312
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2313
// 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
  2314
// 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
  2315
const int Matcher::float_cmove_cost() { return ConditionalMoveLimit; }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2316
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2317
// Power6 requires postalloc expand (see block.cpp for description of postalloc expand).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2318
const bool Matcher::require_postalloc_expand = true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2319
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2320
// 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
  2321
// 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
  2322
// PowerPC requires masked shift counts.
97072ce7c6fe 8080190: PPC64: Fix wrong rotate instructions in the .ad file
simonis
parents: 30303
diff changeset
  2323
const bool Matcher::need_masked_shift_count = true;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2324
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2325
// This affects two different things:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2326
//  - how Decode nodes are matched
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2327
//  - how ImplicitNullCheck opportunities are recognized
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2328
// 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
  2329
// (as operands) into nodes. NullChecks are not prepared to deal with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2330
// Decodes by final_graph_reshaping().
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2331
// If false, final_graph_reshaping() forces the decode behind the Cmp
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2332
// for a NullCheck. The matcher matches the Decode node into a register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2333
// Implicit_null_check optimization moves the Decode along with the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2334
// memory operation back up before the NullCheck.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2335
bool Matcher::narrow_oop_use_complex_address() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2336
  // TODO: PPC port if (MatchDecodeNodes) return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2337
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2338
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2339
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2340
bool Matcher::narrow_klass_use_complex_address() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2341
  NOT_LP64(ShouldNotCallThis());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2342
  assert(UseCompressedClassPointers, "only for compressed klass code");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2343
  // TODO: PPC port if (MatchDecodeNodes) return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2344
  return false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2345
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2346
41673
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2347
bool Matcher::const_oop_prefer_decode() {
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2348
  // 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
  2349
  return Universe::narrow_oop_base() == NULL;
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2350
}
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2351
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2352
bool Matcher::const_klass_prefer_decode() {
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2353
  // 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
  2354
  return Universe::narrow_klass_base() == NULL;
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2355
}
e8b3ccb2cfcf 8155729: C2: Skip transformation of LoadConP for heap-based compressed oops
mdoerr
parents: 39444
diff changeset
  2356
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2357
// 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
  2358
// Intel can load a float constant from a direct address, requiring no
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2359
// extra registers. Most RISCs will have to materialize an address into a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2360
// 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
  2361
const bool Matcher::rematerialize_float_constants = false;
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
// 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
  2364
// 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
  2365
// 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
  2366
// Java calling convention forces doubles to be aligned.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2367
const bool Matcher::misaligned_doubles_ok = true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2368
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2369
void Matcher::pd_implicit_null_fixup(MachNode *node, uint idx) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2370
 Unimplemented();
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2373
// Advertise here if the CPU requires explicit rounding operations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2374
// to implement the UseStrictFP mode.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2375
const bool Matcher::strict_fp_requires_explicit_rounding = false;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2376
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2377
// Do floats take an entire double register or just half?
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
// A float occupies a ppc64 double register. For the allocator, a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2380
// ppc64 double register appears as a pair of float registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2381
bool Matcher::float_in_double() { return true; }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2382
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2383
// Do ints take an entire long register or just half?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2384
// The relevant question is how the int is callee-saved:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2385
// 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
  2386
// the relevant 32 bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2387
const bool Matcher::int_in_long = true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2388
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2389
// Constants for c2c and c calling conventions.
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
const MachRegisterNumbers iarg_reg[8] = {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2392
  R3_num, R4_num, R5_num, R6_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2393
  R7_num, R8_num, R9_num, R10_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2394
};
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2395
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2396
const MachRegisterNumbers farg_reg[13] = {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2397
  F1_num, F2_num, F3_num, F4_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2398
  F5_num, F6_num, F7_num, F8_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2399
  F9_num, F10_num, F11_num, F12_num,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2400
  F13_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2401
};
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2402
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2403
const MachRegisterNumbers vsarg_reg[64] = {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2404
  VSR0_num, VSR1_num, VSR2_num, VSR3_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2405
  VSR4_num, VSR5_num, VSR6_num, VSR7_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2406
  VSR8_num, VSR9_num, VSR10_num, VSR11_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2407
  VSR12_num, VSR13_num, VSR14_num, VSR15_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2408
  VSR16_num, VSR17_num, VSR18_num, VSR19_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2409
  VSR20_num, VSR21_num, VSR22_num, VSR23_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2410
  VSR24_num, VSR23_num, VSR24_num, VSR25_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2411
  VSR28_num, VSR29_num, VSR30_num, VSR31_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2412
  VSR32_num, VSR33_num, VSR34_num, VSR35_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2413
  VSR36_num, VSR37_num, VSR38_num, VSR39_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2414
  VSR40_num, VSR41_num, VSR42_num, VSR43_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2415
  VSR44_num, VSR45_num, VSR46_num, VSR47_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2416
  VSR48_num, VSR49_num, VSR50_num, VSR51_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2417
  VSR52_num, VSR53_num, VSR54_num, VSR55_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2418
  VSR56_num, VSR57_num, VSR58_num, VSR59_num,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2419
  VSR60_num, VSR61_num, VSR62_num, VSR63_num
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2420
};
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2421
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2422
const int num_iarg_registers = sizeof(iarg_reg) / sizeof(iarg_reg[0]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2423
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2424
const int num_farg_registers = sizeof(farg_reg) / sizeof(farg_reg[0]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2425
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2426
const int num_vsarg_registers = sizeof(vsarg_reg) / sizeof(vsarg_reg[0]);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2427
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2428
// 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
  2429
// function is used on startup to build the trampoline stubs in generateOptoStub.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2430
// 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
  2431
// arguments in those registers not be available to the callee.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2432
bool Matcher::can_be_java_arg(int reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2433
  // We return true for all registers contained in iarg_reg[] and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2434
  // farg_reg[] and their virtual halves.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2435
  // 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
  2436
  // instead of STWs and LWs in the trampoline stubs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2437
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2438
  if (   reg == R3_num  || reg == R3_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2439
      || reg == R4_num  || reg == R4_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2440
      || reg == R5_num  || reg == R5_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2441
      || reg == R6_num  || reg == R6_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2442
      || reg == R7_num  || reg == R7_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2443
      || reg == R8_num  || reg == R8_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2444
      || reg == R9_num  || reg == R9_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2445
      || reg == R10_num || reg == R10_H_num)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2446
    return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2447
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2448
  if (   reg == F1_num  || reg == F1_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2449
      || reg == F2_num  || reg == F2_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2450
      || reg == F3_num  || reg == F3_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2451
      || reg == F4_num  || reg == F4_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2452
      || reg == F5_num  || reg == F5_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2453
      || reg == F6_num  || reg == F6_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2454
      || reg == F7_num  || reg == F7_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2455
      || reg == F8_num  || reg == F8_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2456
      || reg == F9_num  || reg == F9_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2457
      || reg == F10_num || reg == F10_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2458
      || reg == F11_num || reg == F11_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2459
      || reg == F12_num || reg == F12_H_num
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2460
      || reg == F13_num || reg == F13_H_num)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2461
    return true;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2462
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2463
  return false;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2466
bool Matcher::is_spillable_arg(int reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2467
  return can_be_java_arg(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2468
}
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
bool Matcher::use_asm_for_ldiv_by_con(jlong divisor) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2471
  return false;
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
// Register for DIVI projection of divmodI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2475
RegMask Matcher::divI_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2476
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2477
  return RegMask();
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2480
// Register for MODI projection of divmodI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2481
RegMask Matcher::modI_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2482
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2483
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2484
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2485
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2486
// Register for DIVL projection of divmodL.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2487
RegMask Matcher::divL_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2488
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2489
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2490
}
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
// Register for MODL projection of divmodL.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2493
RegMask Matcher::modL_proj_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2494
  ShouldNotReachHere();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2495
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2496
}
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
const RegMask Matcher::method_handle_invoke_SP_save_mask() {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2499
  return RegMask();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2500
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2501
38236
510f77046e00 8154943: AArch64: redundant address computation instructions with vectorization
roland
parents: 38228
diff changeset
  2502
const bool Matcher::convi2l_type_required = true;
510f77046e00 8154943: AArch64: redundant address computation instructions with vectorization
roland
parents: 38228
diff changeset
  2503
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2504
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2505
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2506
//----------ENCODING BLOCK-----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2507
// This block specifies the encoding classes used by the compiler to output
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2508
// byte streams. Encoding classes are parameterized macros used by
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2509
// Machine Instruction Nodes in order to generate the bit encoding of the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2510
// instruction. Operands specify their base encoding interface with the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2511
// interface keyword. There are currently supported four interfaces,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2512
// REG_INTER, CONST_INTER, MEMORY_INTER, & COND_INTER. REG_INTER causes an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2513
// operand to generate a function which returns its register number when
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2514
// queried. CONST_INTER causes an operand to generate a function which
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2515
// returns the value of the constant when queried. MEMORY_INTER causes an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2516
// operand to generate four functions which return the Base Register, the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2517
// 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
  2518
// queried. COND_INTER causes an operand to generate six functions which
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2519
// return the encoding code (ie - encoding bits for the instruction)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2520
// associated with each basic boolean condition for a conditional instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2521
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2522
// Instructions specify two basic values for encoding. Again, a function
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2523
// 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
  2524
// ins_encode keyword to specify their encoding classes (which must be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2525
// a sequence of enc_class names, and their parameters, specified in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2526
// the encoding block), and they use the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2527
// opcode keyword to specify, in order, their primary, secondary, and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2528
// tertiary opcode. Only the opcode sections which a particular instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2529
// needs for encoding need to be specified.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2530
encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2531
  enc_class enc_unimplemented %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2532
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2533
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2534
    __ unimplemented("Unimplemented mach node encoding in AD file.", 13);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2535
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2536
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2537
  enc_class enc_untested %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2538
#ifdef ASSERT
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2539
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2540
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2541
    __ untested("Untested mach node encoding in AD file.");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2542
#else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2543
    // TODO: PPC port $archOpcode(ppc64Opcode_none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2544
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2545
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2546
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2547
  enc_class enc_lbz(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2548
    // TODO: PPC port $archOpcode(ppc64Opcode_lbz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2549
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2550
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2551
    __ lbz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2552
  %}
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
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2555
  enc_class enc_lbz_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2556
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2557
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2558
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2559
    __ lbz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2560
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2561
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2562
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2563
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2564
  enc_class enc_lhz(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2565
    // TODO: PPC port $archOpcode(ppc64Opcode_lhz);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2568
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2569
    __ lhz($dst$$Register, Idisp, $mem$$base$$Register);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2572
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2573
  enc_class enc_lhz_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2574
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2577
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2578
    __ lhz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2579
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2580
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2581
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2582
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2583
  enc_class enc_lwz(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2584
    // TODO: PPC port $archOpcode(ppc64Opcode_lwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2585
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2586
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2587
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2588
    __ lwz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2589
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2590
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2591
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2592
  enc_class enc_lwz_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2593
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2594
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2595
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2596
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2597
    __ lwz($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2598
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2599
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2600
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2601
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2602
  enc_class enc_ld(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2603
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2604
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2605
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2606
    // Operand 'ds' requires 4-alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2607
    assert((Idisp & 0x3) == 0, "unaligned offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2608
    __ ld($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2609
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2610
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2611
  // Load acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2612
  enc_class enc_ld_ac(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2613
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2614
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2615
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2616
    // Operand 'ds' requires 4-alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2617
    assert((Idisp & 0x3) == 0, "unaligned offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2618
    __ ld($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2619
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2620
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2621
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2622
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2623
  enc_class enc_lfd(RegF dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2624
    // TODO: PPC port $archOpcode(ppc64Opcode_lfd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2625
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2626
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2627
    __ lfd($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2628
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2629
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2630
  enc_class enc_load_long_constL(iRegLdst dst, immL src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2631
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2632
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2633
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2634
    int toc_offset = 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2635
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2636
    address const_toc_addr;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2637
    // Create a non-oop constant, no relocation needed.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2638
    // If it is an IC, it has a virtual_call_Relocation.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2639
    const_toc_addr = __ long_constant((jlong)$src$$constant);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2640
    if (const_toc_addr == NULL) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2641
      ciEnv::current()->record_out_of_memory_failure();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2642
      return;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2643
    }
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2644
    
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2645
    // Get the constant's TOC offset.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2646
    toc_offset = __ offset_to_method_toc(const_toc_addr);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2647
    
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2648
    // Keep the current instruction offset in mind.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2649
    ((loadConLNode*)this)->_cbuf_insts_offset = __ offset();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2650
  
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2651
    __ ld($dst$$Register, toc_offset, $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2652
  %}
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
  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
  2655
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2656
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2657
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2658
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2659
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2660
      address const_toc_addr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2661
      // Create a non-oop constant, no relocation needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2662
      // If it is an IC, it has a virtual_call_Relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2663
      const_toc_addr = __ long_constant((jlong)$src$$constant);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2664
      if (const_toc_addr == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2665
        ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2666
        return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2667
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2668
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2669
      // Get the constant's TOC offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2670
      const int toc_offset = __ offset_to_method_toc(const_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2671
      // Store the toc offset of the constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2672
      ((loadConL_hiNode*)this)->_const_toc_offset = toc_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2673
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2674
      // Also keep the current instruction offset in mind.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2675
      ((loadConL_hiNode*)this)->_cbuf_insts_offset = __ offset();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2676
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2677
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2678
    __ 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
  2679
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2680
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2681
%} // encode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2682
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2683
source %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2684
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2685
typedef struct {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2686
  loadConL_hiNode *_large_hi;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2687
  loadConL_loNode *_large_lo;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2688
  loadConLNode    *_small;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2689
  MachNode        *_last;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2690
} loadConLNodesTuple;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2691
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  2692
loadConLNodesTuple loadConLNodesTuple_create(PhaseRegAlloc *ra_, Node *toc, immLOper *immSrc,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2693
                                             OptoReg::Name reg_second, OptoReg::Name reg_first) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2694
  loadConLNodesTuple nodes;
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
  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
  2697
  if (large_constant_pool) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2698
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2699
    loadConL_hiNode *m1 = new loadConL_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2700
    loadConL_loNode *m2 = new loadConL_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2701
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2702
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2703
    m1->add_req(NULL, toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2704
    m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2705
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2706
    // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2707
    m1->_opnds[0] = new iRegLdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2708
    m1->_opnds[1] = immSrc;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2709
    m1->_opnds[2] = new iRegPdstOper(); // toc
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2710
    m2->_opnds[0] = new iRegLdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2711
    m2->_opnds[1] = immSrc;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2712
    m2->_opnds[2] = new iRegLdstOper(); // base
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2713
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2714
    // Initialize ins_attrib TOC fields.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2715
    m1->_const_toc_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2716
    m2->_const_toc_offset_hi_node = m1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2717
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2718
    // Initialize ins_attrib instruction offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2719
    m1->_cbuf_insts_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2720
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2721
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2722
    ra_->set_pair(m1->_idx, reg_second, reg_first);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2723
    ra_->set_pair(m2->_idx, reg_second, reg_first);
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
    // Create result.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2726
    nodes._large_hi = m1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2727
    nodes._large_lo = m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2728
    nodes._small = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2729
    nodes._last = nodes._large_lo;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2730
    assert(m2->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2731
  } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2732
    loadConLNode *m2 = new loadConLNode();
22861
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
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2735
    m2->add_req(NULL, toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2736
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2737
    // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2738
    m2->_opnds[0] = new iRegLdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2739
    m2->_opnds[1] = immSrc;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2740
    m2->_opnds[2] = new iRegPdstOper(); // toc
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2741
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2742
    // Initialize ins_attrib instruction offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2743
    m2->_cbuf_insts_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2744
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2745
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2746
    ra_->set_pair(m2->_idx, reg_second, reg_first);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2747
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2748
    // Create result.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2749
    nodes._large_hi = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2750
    nodes._large_lo = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2751
    nodes._small = m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2752
    nodes._last = nodes._small;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2753
    assert(m2->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2754
  }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2755
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2756
  return nodes;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2757
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2758
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2759
typedef struct {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2760
  loadConL_hiNode *_large_hi;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2761
  loadConL_loNode *_large_lo;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2762
  mtvsrdNode      *_moved;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2763
  xxspltdNode     *_replicated;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2764
  loadConLNode    *_small;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2765
  MachNode        *_last;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2766
} loadConLReplicatedNodesTuple;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2767
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2768
loadConLReplicatedNodesTuple loadConLReplicatedNodesTuple_create(Compile *C, PhaseRegAlloc *ra_, Node *toc, immLOper *immSrc, 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2769
                                                 vecXOper *dst, immI_0Oper *zero,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2770
                                                 OptoReg::Name reg_second, OptoReg::Name reg_first,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2771
                                                 OptoReg::Name reg_vec_second, OptoReg::Name reg_vec_first) {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2772
  loadConLReplicatedNodesTuple nodes;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2773
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2774
  const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2775
  if (large_constant_pool) {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2776
    // Create new nodes.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2777
    loadConL_hiNode *m1 = new  loadConL_hiNode();
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2778
    loadConL_loNode *m2 = new  loadConL_loNode();
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2779
    mtvsrdNode *m3 = new  mtvsrdNode();
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2780
    xxspltdNode *m4 = new  xxspltdNode();
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2781
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2782
    // inputs for new nodes
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2783
    m1->add_req(NULL, toc);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2784
    m2->add_req(NULL, m1);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2785
    m3->add_req(NULL, m2);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2786
    m4->add_req(NULL, m3);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2787
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2788
    // operands for new nodes
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2789
    m1->_opnds[0] = new  iRegLdstOper(); // dst
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2790
    m1->_opnds[1] = immSrc;              // src
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2791
    m1->_opnds[2] = new  iRegPdstOper(); // toc
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2792
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2793
    m2->_opnds[0] = new  iRegLdstOper(); // dst
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2794
    m2->_opnds[1] = immSrc;              // src
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2795
    m2->_opnds[2] = new  iRegLdstOper(); // base
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2796
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2797
    m3->_opnds[0] = new  vecXOper();     // dst
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2798
    m3->_opnds[1] = new  iRegLdstOper(); // src
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2799
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2800
    m4->_opnds[0] = new  vecXOper();     // dst
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2801
    m4->_opnds[1] = new  vecXOper();     // src
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2802
    m4->_opnds[2] = zero;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2803
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2804
    // Initialize ins_attrib TOC fields.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2805
    m1->_const_toc_offset = -1;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2806
    m2->_const_toc_offset_hi_node = m1;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2807
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2808
    // Initialize ins_attrib instruction offset.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2809
    m1->_cbuf_insts_offset = -1;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2810
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2811
    // register allocation for new nodes
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2812
    ra_->set_pair(m1->_idx, reg_second, reg_first);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2813
    ra_->set_pair(m2->_idx, reg_second, reg_first);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2814
    ra_->set1(m3->_idx, reg_second);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2815
    ra_->set2(m3->_idx, reg_vec_first);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2816
    ra_->set_pair(m4->_idx, reg_vec_second, reg_vec_first);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2817
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2818
    // Create result.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2819
    nodes._large_hi = m1;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2820
    nodes._large_lo = m2;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2821
    nodes._moved = m3;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2822
    nodes._replicated = m4;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2823
    nodes._small = NULL;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2824
    nodes._last = nodes._replicated;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2825
    assert(m2->bottom_type()->isa_long(), "must be long");
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2826
  } else {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2827
    loadConLNode *m2 = new  loadConLNode();
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2828
    mtvsrdNode *m3 = new  mtvsrdNode();
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2829
    xxspltdNode *m4 = new  xxspltdNode();
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2830
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2831
    // inputs for new nodes
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2832
    m2->add_req(NULL, toc);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2833
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2834
    // operands for new nodes
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2835
    m2->_opnds[0] = new  iRegLdstOper(); // dst
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2836
    m2->_opnds[1] = immSrc;              // src
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2837
    m2->_opnds[2] = new  iRegPdstOper(); // toc
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2838
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2839
    m3->_opnds[0] = new  vecXOper();     // dst
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2840
    m3->_opnds[1] = new  iRegLdstOper(); // src
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2841
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2842
    m4->_opnds[0] = new  vecXOper();     // dst
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2843
    m4->_opnds[1] = new  vecXOper();     // src
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2844
    m4->_opnds[2] = zero;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2845
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2846
    // Initialize ins_attrib instruction offset.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2847
    m2->_cbuf_insts_offset = -1;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2848
    ra_->set1(m3->_idx, reg_second);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2849
    ra_->set2(m3->_idx, reg_vec_first);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2850
    ra_->set_pair(m4->_idx, reg_vec_second, reg_vec_first);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2851
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2852
    // register allocation for new nodes
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2853
    ra_->set_pair(m2->_idx, reg_second, reg_first);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2854
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2855
    // Create result.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2856
    nodes._large_hi = NULL;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2857
    nodes._large_lo = NULL;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2858
    nodes._small = m2;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2859
    nodes._moved = m3;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2860
    nodes._replicated = m4;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2861
    nodes._last = nodes._replicated;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2862
    assert(m2->bottom_type()->isa_long(), "must be long");
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2863
  }
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2864
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2865
  return nodes;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2866
}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  2867
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2868
%} // source
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
encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2871
  // 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
  2872
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2873
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2874
  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
  2875
    // Create new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2876
    loadConLNodesTuple loadConLNodes =
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  2877
      loadConLNodesTuple_create(ra_, n_toc, op_src,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2878
                                ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2879
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2880
    // Push new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2881
    if (loadConLNodes._large_hi) nodes->push(loadConLNodes._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2882
    if (loadConLNodes._last)     nodes->push(loadConLNodes._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2883
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2884
    // some asserts
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2885
    assert(nodes->length() >= 1, "must have created at least 1 node");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2886
    assert(loadConLNodes._last->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2887
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2888
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2889
  enc_class enc_load_long_constP(iRegLdst dst, immP src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2890
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2891
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2892
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2893
    int toc_offset = 0;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2894
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2895
    intptr_t val = $src$$constant;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2896
    relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2897
    address const_toc_addr;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2898
    if (constant_reloc == relocInfo::oop_type) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2899
      // Create an oop constant and a corresponding relocation.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2900
      AddressLiteral a = __ allocate_oop_address((jobject)val);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2901
      const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2902
      __ relocate(a.rspec());
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2903
    } else if (constant_reloc == relocInfo::metadata_type) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2904
      AddressLiteral a = __ constant_metadata_address((Metadata *)val);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2905
      const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2906
      __ relocate(a.rspec());
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2907
    } else {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2908
      // Create a non-oop constant, no relocation needed.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2909
      const_toc_addr = __ long_constant((jlong)$src$$constant);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2910
    }
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2911
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2912
    if (const_toc_addr == NULL) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2913
      ciEnv::current()->record_out_of_memory_failure();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2914
      return;
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2915
    }
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2916
    // Get the constant's TOC offset.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  2917
    toc_offset = __ offset_to_method_toc(const_toc_addr);
22861
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
    __ ld($dst$$Register, toc_offset, $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2920
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2921
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2922
  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
  2923
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2924
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2925
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2926
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2927
      intptr_t val = $src$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2928
      relocInfo::relocType constant_reloc = $src->constant_reloc();  // src
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2929
      address const_toc_addr;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2930
      if (constant_reloc == relocInfo::oop_type) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2931
        // Create an oop constant and a corresponding relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2932
        AddressLiteral a = __ allocate_oop_address((jobject)val);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2933
        const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2934
        __ relocate(a.rspec());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2935
      } else if (constant_reloc == relocInfo::metadata_type) {
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  2936
        AddressLiteral a = __ constant_metadata_address((Metadata *)val);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2937
        const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2938
        __ relocate(a.rspec());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2939
      } else {  // non-oop pointers, e.g. card mark base, heap top
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2940
        // Create a non-oop constant, no relocation needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2941
        const_toc_addr = __ long_constant((jlong)$src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2942
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2943
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2944
      if (const_toc_addr == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2945
        ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2946
        return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  2947
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2948
      // Get the constant's TOC offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2949
      const int toc_offset = __ offset_to_method_toc(const_toc_addr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2950
      // Store the toc offset of the constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2951
      ((loadConP_hiNode*)this)->_const_toc_offset = toc_offset;
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2954
    __ 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
  2955
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2956
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2957
  // 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
  2958
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2959
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2960
  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
  2961
    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
  2962
    if (large_constant_pool) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2963
      // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2964
      loadConP_hiNode *m1 = new loadConP_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2965
      loadConP_loNode *m2 = new loadConP_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2966
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2967
      // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2968
      m1->add_req(NULL, n_toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2969
      m2->add_req(NULL, m1);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2970
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2971
      // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2972
      m1->_opnds[0] = new iRegPdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2973
      m1->_opnds[1] = op_src;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2974
      m1->_opnds[2] = new iRegPdstOper(); // toc
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2975
      m2->_opnds[0] = new iRegPdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2976
      m2->_opnds[1] = op_src;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2977
      m2->_opnds[2] = new iRegLdstOper(); // base
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2978
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2979
      // Initialize ins_attrib TOC fields.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2980
      m1->_const_toc_offset = -1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2981
      m2->_const_toc_offset_hi_node = m1;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2982
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2983
      // Register allocation for new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2984
      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
  2985
      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
  2986
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2987
      nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2988
      nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2989
      assert(m2->bottom_type()->isa_ptr(), "must be ptr");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2990
    } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2991
      loadConPNode *m2 = new loadConPNode();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2992
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2993
      // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2994
      m2->add_req(NULL, n_toc);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  2995
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  2996
      // operands for new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2997
      m2->_opnds[0] = new iRegPdstOper(); // dst
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2998
      m2->_opnds[1] = op_src;             // src
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  2999
      m2->_opnds[2] = new iRegPdstOper(); // toc
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3000
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3001
      // Register allocation for new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3002
      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
  3003
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3004
      nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3005
      assert(m2->bottom_type()->isa_ptr(), "must be ptr");
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
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3008
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3009
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3010
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3011
  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
  3012
    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
  3013
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3014
    MachNode *m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3015
    if (large_constant_pool) {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3016
      m2 = new loadConFCompNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3017
    } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3018
      m2 = new loadConFNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3019
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3020
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3021
    m2->add_req(NULL, n_toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3022
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3023
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3024
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3025
    m2->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3026
    m2->_opnds[2] = new iRegPdstOper(); // constanttablebase
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3027
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3028
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3029
    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
  3030
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3031
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3032
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3033
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3034
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3035
  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
  3036
    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
  3037
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3038
    MachNode *m2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3039
    if (large_constant_pool) {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3040
      m2 = new loadConDCompNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3041
    } else {
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3042
      m2 = new loadConDNode();
22861
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
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3045
    m2->add_req(NULL, n_toc);
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
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3048
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3049
    m2->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3050
    m2->_opnds[2] = new iRegPdstOper(); // constanttablebase
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3051
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3052
    // register allocation for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3053
    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
  3054
    nodes->push(m2);
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_stw(iRegIsrc src, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3058
    // TODO: PPC port $archOpcode(ppc64Opcode_stw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3059
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3060
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3061
    __ stw($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3062
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3063
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3064
  enc_class enc_std(iRegIsrc src, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3065
    // TODO: PPC port $archOpcode(ppc64Opcode_std);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3066
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3067
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3068
    // Operand 'ds' requires 4-alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3069
    assert((Idisp & 0x3) == 0, "unaligned offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3070
    __ std($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3071
  %}
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
  enc_class enc_stfs(RegF src, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3074
    // TODO: PPC port $archOpcode(ppc64Opcode_stfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3075
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3076
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3077
    __ stfs($src$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3078
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3079
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3080
  enc_class enc_stfd(RegF src, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3081
    // TODO: PPC port $archOpcode(ppc64Opcode_stfd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3082
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3083
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3084
    __ stfd($src$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3085
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3086
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3087
  // Use release_store for card-marking to ensure that previous
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3088
  // oop-stores are visible before the card-mark change.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3089
  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
  3090
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3091
    // FIXME: Implement this as a cmove and use a fixed condition code
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3092
    // register which is written on every transition to compiled code,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3093
    // e.g. in call-stub and when returning from runtime stubs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3094
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3095
    // Proposed code sequence for the cmove implementation:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3096
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3097
    // Label skip_release;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3098
    // __ beq(CCRfixed, skip_release);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3099
    // __ release();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3100
    // __ bind(skip_release);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3101
    // __ stb(card mark);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3102
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3103
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3104
    Label skip_storestore;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3105
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3106
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3107
    // Check CMSCollectorCardTableModRefBSExt::_requires_release and do the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3108
    // StoreStore barrier conditionally.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3109
    __ lwz(R0, 0, $releaseFieldAddr$$Register);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3110
    __ cmpwi($crx$$CondRegister, R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3111
    __ beq_predict_taken($crx$$CondRegister, skip_storestore);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3112
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3113
    __ li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3114
    __ membar(Assembler::StoreStore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3115
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3116
    __ bind(skip_storestore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3117
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3118
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3119
    // Do the store.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3120
    if ($mem$$index == 0) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3121
      __ stb(R0, $mem$$disp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3122
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3123
      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
  3124
      __ stbx(R0, $mem$$base$$Register, $mem$$index$$Register);
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
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3127
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3128
  enc_class postalloc_expand_encode_oop(iRegNdst dst, iRegPdst src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3129
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3130
    if (VM_Version::has_isel()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3131
      // use isel instruction with Power 7
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3132
      cmpP_reg_imm16Node *n_compare  = new cmpP_reg_imm16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3133
      encodeP_subNode    *n_sub_base = new encodeP_subNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3134
      encodeP_shiftNode  *n_shift    = new encodeP_shiftNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3135
      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
  3136
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3137
      n_compare->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3138
      n_compare->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3139
      n_compare->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3140
      n_compare->_opnds[2] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3141
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3142
      n_sub_base->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3143
      n_sub_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3144
      n_sub_base->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3145
      n_sub_base->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3146
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3147
      n_shift->add_req(n_region, n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3148
      n_shift->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3149
      n_shift->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3150
      n_shift->_bottom_type = _bottom_type;
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
      n_cond_set->add_req(n_region, n_compare, n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3153
      n_cond_set->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3154
      n_cond_set->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3155
      n_cond_set->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3156
      n_cond_set->_bottom_type = _bottom_type;
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
      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
  3159
      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
  3160
      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
  3161
      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
  3162
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3163
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3164
      nodes->push(n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3165
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3166
      nodes->push(n_cond_set);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3167
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3168
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3169
      // before Power 7
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3170
      moveRegNode        *n_move     = new moveRegNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3171
      cmpP_reg_imm16Node *n_compare  = new cmpP_reg_imm16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3172
      encodeP_shiftNode  *n_shift    = new encodeP_shiftNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3173
      cond_sub_baseNode  *n_sub_base = new cond_sub_baseNode();
22861
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
      n_move->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3176
      n_move->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3177
      n_move->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3178
      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
  3179
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3180
      n_compare->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3181
      n_compare->add_prec(n_move);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3182
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3183
      n_compare->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3184
      n_compare->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3185
      n_compare->_opnds[2] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3186
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3187
      n_sub_base->add_req(n_region, n_compare, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3188
      n_sub_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3189
      n_sub_base->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3190
      n_sub_base->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3191
      n_sub_base->_bottom_type = _bottom_type;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3192
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3193
      n_shift->add_req(n_region, n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3194
      n_shift->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3195
      n_shift->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3196
      n_shift->_bottom_type = _bottom_type;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3197
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3198
      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
  3199
      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
  3200
      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
  3201
      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
  3202
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3203
      nodes->push(n_move);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3204
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3205
      nodes->push(n_sub_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3206
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3207
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3208
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3209
    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
  3210
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3211
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3212
  enc_class postalloc_expand_encode_oop_not_null(iRegNdst dst, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3213
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3214
    encodeP_subNode *n1 = new encodeP_subNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3215
    n1->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3216
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3217
    n1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3218
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3219
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3220
    encodeP_shiftNode *n2 = new encodeP_shiftNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3221
    n2->add_req(n_region, n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3222
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3223
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3224
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3225
    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
  3226
    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
  3227
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3228
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3229
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3230
    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
  3231
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3232
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3233
  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
  3234
    decodeN_shiftNode *n_shift    = new decodeN_shiftNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3235
    cmpN_reg_imm0Node *n_compare  = new cmpN_reg_imm0Node();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3236
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3237
    n_compare->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3238
    n_compare->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3239
    n_compare->_opnds[1] = op_src;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3240
    n_compare->_opnds[2] = new immN_0Oper(TypeNarrowOop::NULL_PTR);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3241
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3242
    n_shift->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3243
    n_shift->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3244
    n_shift->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3245
    n_shift->_bottom_type = _bottom_type;
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
    if (VM_Version::has_isel()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3248
      // use isel instruction with Power 7
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3249
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3250
      decodeN_addNode *n_add_base = new decodeN_addNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3251
      n_add_base->add_req(n_region, n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3252
      n_add_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3253
      n_add_base->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3254
      n_add_base->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3255
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3256
      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
  3257
      n_cond_set->add_req(n_region, n_compare, n_add_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3258
      n_cond_set->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3259
      n_cond_set->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3260
      n_cond_set->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3261
      n_cond_set->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3262
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3263
      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
  3264
      ra_->set_oop(n_cond_set, true);
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
      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
  3267
      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
  3268
      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
  3269
      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
  3270
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3271
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3272
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3273
      nodes->push(n_add_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3274
      nodes->push(n_cond_set);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3275
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3276
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3277
      // before Power 7
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3278
      cond_add_baseNode *n_add_base = new cond_add_baseNode();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3279
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3280
      n_add_base->add_req(n_region, n_compare, n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3281
      n_add_base->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3282
      n_add_base->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3283
      n_add_base->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3284
      n_add_base->_bottom_type = _bottom_type;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3285
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3286
      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
  3287
      ra_->set_oop(n_add_base, true);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3288
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3289
      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
  3290
      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
  3291
      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
  3292
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3293
      nodes->push(n_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3294
      nodes->push(n_shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3295
      nodes->push(n_add_base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3296
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3297
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3298
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3299
  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
  3300
    decodeN_shiftNode *n1 = new decodeN_shiftNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3301
    n1->add_req(n_region, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3302
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3303
    n1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3304
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3305
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3306
    decodeN_addNode *n2 = new decodeN_addNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3307
    n2->add_req(n_region, n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3308
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3309
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3310
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3311
    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
  3312
    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
  3313
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3314
    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
  3315
    ra_->set_oop(n2, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3316
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3317
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3318
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3319
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3320
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3321
  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
  3322
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3325
    int cc        = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3326
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3327
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3328
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3329
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3330
    __ 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
  3331
    __ mr($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3332
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3333
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3334
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3335
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3336
  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
  3337
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3338
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3339
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3340
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3341
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3342
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3343
    __ 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
  3344
    __ li($dst$$Register, $src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3345
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3346
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3347
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3348
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3349
  // This enc_class is needed so that scheduler gets proper
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3350
  // input mapping for latency computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3351
  enc_class enc_andc(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3352
    // TODO: PPC port $archOpcode(ppc64Opcode_andc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3353
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3354
    __ andc($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3355
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3356
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3357
  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
  3358
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3359
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3360
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3361
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3362
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3363
    __ cmpwi($crx$$CondRegister, $src$$Register, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3364
    __ li($dst$$Register, $zero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3365
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3366
    __ li($dst$$Register, $notzero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3367
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3368
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3369
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3370
  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
  3371
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3374
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3375
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3376
    __ cmpdi($crx$$CondRegister, $src$$Register, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3377
    __ li($dst$$Register, $zero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3378
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3379
    __ li($dst$$Register, $notzero$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3380
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3381
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3382
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3383
  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
  3384
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3385
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3386
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3387
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3388
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3389
    __ bso($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3390
    __ ld($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3391
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3392
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3393
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3394
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3395
  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
  3396
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3397
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3398
    MacroAssembler _masm(&cbuf);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3399
    Label done;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3400
    __ bso($crx$$CondRegister, done);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3401
    __ mffprd($dst$$Register, $src$$FloatRegister);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3402
    // TODO PPC port __ endgroup_if_needed(_size == 12);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3403
    __ bind(done);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3404
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
  3405
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3406
  enc_class enc_bc(flagsRegSrc crx, cmpOp cmp, Label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3407
    // TODO: PPC port $archOpcode(ppc64Opcode_bc);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3410
    Label d;   // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3411
    __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3412
    Label* p = ($lbl$$label);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3413
    // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3414
    // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3415
    Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3416
    int cc = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3417
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3418
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3419
    int bhint = Assembler::bhintNoHint;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3420
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3421
    if (UseStaticBranchPredictionForUncommonPathsPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3422
      if (_prob <= PROB_NEVER) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3423
        bhint = Assembler::bhintIsNotTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3424
      } else if (_prob >= PROB_ALWAYS) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3425
        bhint = Assembler::bhintIsTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3426
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3427
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3428
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3429
    __ bc(Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3430
          cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3431
          l);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3432
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3433
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3434
  enc_class enc_bc_far(flagsRegSrc crx, cmpOp cmp, Label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3435
    // 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
  3436
    // to ppc64Opcode_bc in order to hide this detail from the scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3437
    // TODO: PPC port $archOpcode(ppc64Opcode_bc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3438
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3439
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3440
    Label d;    // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3441
    __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3442
    Label* p = ($lbl$$label);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3443
    // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3444
    // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3445
    Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3446
    int cc = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3447
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3448
    int bhint = Assembler::bhintNoHint;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3449
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3450
    if (UseStaticBranchPredictionForUncommonPathsPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3451
      if (_prob <= PROB_NEVER) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3452
        bhint = Assembler::bhintIsNotTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3453
      } else if (_prob >= PROB_ALWAYS) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3454
        bhint = Assembler::bhintIsTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3455
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3456
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3457
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3458
    // Tell the conditional far branch to optimize itself when being relocated.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3459
    __ bc_far(Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3460
                  cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3461
                  l,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3462
                  MacroAssembler::bc_far_optimize_on_relocate);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3463
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3464
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3465
  // Branch used with Power6 scheduling (can be shortened without changing the node).
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  3466
  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
  3467
    // 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
  3468
    // to ppc64Opcode_bc in order to hide this detail from the scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3469
    // TODO: PPC port $archOpcode(ppc64Opcode_bc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3470
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3471
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3472
    Label d;   // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3473
    __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3474
    Label* p = ($lbl$$label);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3475
    // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3476
    // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3477
    Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3478
    int cc = $cmp$$cmpcode;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3479
    int flags_reg = $crx$$reg;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3480
    int bhint = Assembler::bhintNoHint;
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
    if (UseStaticBranchPredictionForUncommonPathsPPC64) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3483
      if (_prob <= PROB_NEVER) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3484
        bhint = Assembler::bhintIsNotTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3485
      } else if (_prob >= PROB_ALWAYS) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3486
        bhint = Assembler::bhintIsTaken;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3487
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3488
    }
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
#if 0 // TODO: PPC port
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3491
    if (_size == 8) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3492
      // Tell the conditional far branch to optimize itself when being relocated.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3493
      __ bc_far(Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3494
                    cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3495
                    l,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3496
                    MacroAssembler::bc_far_optimize_on_relocate);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3497
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3498
      __ bc    (Assembler::add_bhint_to_boint(bhint, cc_to_boint(cc)),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3499
                    cc_to_biint(cc, flags_reg),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3500
                    l);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3501
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3502
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3503
    Unimplemented();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3504
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3505
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3506
  // Postalloc expand emitter for loading a replicatef float constant from
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3507
  // the method's TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3508
  // Enc_class needed as consttanttablebase is not supported by postalloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3509
  // expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3510
  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
  3511
    // Create new nodes.
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
    // 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
  3514
    immLOper *op_repl = new immLOper((jlong)replicate_immF(op_src->constantF()));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3515
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3516
    loadConLNodesTuple loadConLNodes =
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3517
      loadConLNodesTuple_create(ra_, n_toc, op_repl,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3518
                                ra_->get_reg_second(this), ra_->get_reg_first(this));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3519
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3520
    // Push new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3521
    if (loadConLNodes._large_hi) nodes->push(loadConLNodes._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3522
    if (loadConLNodes._last)     nodes->push(loadConLNodes._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3523
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3524
    assert(nodes->length() >= 1, "must have created at least 1 node");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3525
    assert(loadConLNodes._last->bottom_type()->isa_long(), "must be long");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3526
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3527
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3528
  enc_class postalloc_expand_load_replF_constant_vsx(vecX dst, immF src, iRegLdst toc) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3529
    // Create new nodes.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3530
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3531
    // Make an operand with the bit pattern to load as float.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3532
    immLOper *op_repl = new  immLOper((jlong)replicate_immF(op_src->constantF()));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3533
    immI_0Oper *op_zero = new  immI_0Oper(0);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3534
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3535
    loadConLReplicatedNodesTuple loadConLNodes =
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3536
      loadConLReplicatedNodesTuple_create(C, ra_, n_toc, op_repl, op_dst, op_zero,
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3537
                                OptoReg::Name(R20_H_num), OptoReg::Name(R20_num),
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3538
                                OptoReg::Name(VSR11_num), OptoReg::Name(VSR10_num));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3539
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3540
    // Push new nodes.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3541
    if (loadConLNodes._large_hi) { nodes->push(loadConLNodes._large_hi); }
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3542
    if (loadConLNodes._large_lo) { nodes->push(loadConLNodes._large_lo); }
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3543
    if (loadConLNodes._moved)    { nodes->push(loadConLNodes._moved); }
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3544
    if (loadConLNodes._last)     { nodes->push(loadConLNodes._last); }
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3545
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3546
    assert(nodes->length() >= 1, "must have created at least 1 node");
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3547
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  3548
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3549
  // This enc_class is needed so that scheduler gets proper
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3550
  // input mapping for latency computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3551
  enc_class enc_poll(immI dst, iRegLdst poll) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3552
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3553
    // Fake operand dst needed for PPC scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3554
    assert($dst$$constant == 0x0, "dst must be 0x0");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3555
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3556
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3557
    // Mark the code position where the load from the safepoint
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3558
    // polling page was emitted as relocInfo::poll_type.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3559
    __ relocate(relocInfo::poll_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3560
    __ load_from_polling_page($poll$$Register);
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
  // A Java static call or a runtime call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3564
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3565
  // Branch-and-link relative to a trampoline.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3566
  // 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
  3567
  // In case we call java, the trampoline branches to a interpreter_stub
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3568
  // 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
  3569
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3570
  // This basically looks like this:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3571
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3572
  // >>>> consts      -+  -+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3573
  //                   |   |- offset1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3574
  // [call target1]    | <-+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3575
  // [IC cache]        |- offset2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3576
  // [call target2] <--+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3577
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3578
  // <<<< consts
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3579
  // >>>> insts
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3580
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3581
  // bl offset16               -+  -+             ??? // How many bits available?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3582
  //                            |   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3583
  // <<<< insts                 |   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3584
  // >>>> stubs                 |   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3585
  //                            |   |- trampoline_stub_Reloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3586
  // trampoline stub:           | <-+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3587
  //   r2 = toc                 |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3588
  //   r2 = [r2 + offset1]      |       // Load call target1 from const section
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3589
  //   mtctr r2                 |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3590
  //   bctr                     |- static_stub_Reloc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3591
  // comp_to_interp_stub:   <---+
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3592
  //   r1 = toc
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3593
  //   ICreg = [r1 + IC_offset]         // Load IC from const section
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3594
  //   r1    = [r1 + offset2]           // Load call target2 from const section
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3595
  //   mtctr r1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3596
  //   bctr
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3597
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3598
  // <<<< stubs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3599
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3600
  // The call instruction in the code either
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3601
  // - 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
  3602
  // - 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
  3603
  // - Branches to the compiled_to_interp stub if the target is interpreted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3604
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3605
  // Further there are three relocations from the loads to the constants in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3606
  // the constant section.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3607
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3608
  // Usage of r1 and r2 in the stubs allows to distinguish them.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3609
  enc_class enc_java_static_call(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3610
    // TODO: PPC port $archOpcode(ppc64Opcode_bl);
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
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3613
    address entry_point = (address)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3614
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3615
    if (!_method) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3616
      // 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
  3617
      emit_call_with_trampoline_stub(_masm, entry_point, relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3618
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3619
      // Remember the offset not the address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3620
      const int start_offset = __ offset();
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3621
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3622
      // The trampoline stub.
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3623
      // No entry point given, use the current pc.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3624
      // Make sure branch fits into
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3625
      if (entry_point == 0) entry_point = __ pc();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3626
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3627
      // Put the entry point as a constant into the constant pool.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3628
      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
  3629
      if (entry_point_toc_addr == NULL) {
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3630
        ciEnv::current()->record_out_of_memory_failure();
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3631
        return;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3632
      }
41685
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3633
      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
  3634
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3635
      // 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
  3636
      CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3637
      if (ciEnv::current()->failing()) { return; } // Code cache may be full.
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3638
      int method_index = resolved_method_index(cbuf);
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3639
      __ relocate(_optimized_virtual ? opt_virtual_call_Relocation::spec(method_index)
7df85c88cdc0 8166562: C2: Suppress relocations in scratch emit.
goetz
parents: 41673
diff changeset
  3640
                  : static_call_Relocation::spec(method_index));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3641
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3642
      // The real call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3643
      // 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
  3644
      // 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
  3645
      // serves as dummy and the bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3646
      cbuf.set_insts_mark();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3647
      __ bl(__ pc());  // Emits a relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3648
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3649
      // 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
  3650
      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
  3651
      if (stub == NULL) {
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  3652
        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
  3653
        return;
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 31773
diff changeset
  3654
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3655
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3656
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3657
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3658
  // Second node of expanded dynamic call - the call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3659
  enc_class enc_java_dynamic_call_sched(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3660
    // TODO: PPC port $archOpcode(ppc64Opcode_bl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3661
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3662
    MacroAssembler _masm(&cbuf);
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
    if (!ra_->C->in_scratch_emit_size()) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3665
      // Create a call trampoline stub for the given method.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3666
      const address entry_point = !($meth$$method) ? 0 : (address)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3667
      const address entry_point_const = __ address_constant(entry_point, RelocationHolder::none);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3668
      if (entry_point_const == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3669
        ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3670
        return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3671
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3672
      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
  3673
      CallStubImpl::emit_trampoline_stub(_masm, entry_point_const_toc_offset, __ offset());
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  3674
      if (ra_->C->env()->failing()) { return; } // Code cache may be full.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3675
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3676
      // Build relocation at call site with ic position as data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3677
      assert((_load_ic_hi_node != NULL && _load_ic_node == NULL) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3678
             (_load_ic_hi_node == NULL && _load_ic_node != NULL),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3679
             "must have one, but can't have both");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3680
      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
  3681
             (_load_ic_node != NULL    && _load_ic_node->_cbuf_insts_offset != -1),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3682
             "must contain instruction offset");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3683
      const int virtual_call_oop_addr_offset = _load_ic_hi_node != NULL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3684
        ? _load_ic_hi_node->_cbuf_insts_offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3685
        : _load_ic_node->_cbuf_insts_offset;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3686
      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
  3687
      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
  3688
             "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
  3689
      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
  3690
      __ relocate(virtual_call_Relocation::spec(virtual_call_oop_addr, method_index));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3691
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3692
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3693
    // 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
  3694
    // 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
  3695
    // as dummy and bl will be patched later.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3696
    __ bl((address) __ pc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3697
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3698
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3699
  // postalloc expand emitter for virtual calls.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3700
  enc_class postalloc_expand_java_dynamic_call_sched(method meth, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3701
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3702
    // Create the nodes for loading the IC from the TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3703
    loadConLNodesTuple loadConLNodes_IC =
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3704
      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
  3705
                                OptoReg::Name(R19_H_num), OptoReg::Name(R19_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3706
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3707
    // Create the call node.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3708
    CallDynamicJavaDirectSchedNode *call = new CallDynamicJavaDirectSchedNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3709
    call->_method_handle_invoke = _method_handle_invoke;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3710
    call->_vtable_index      = _vtable_index;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3711
    call->_method            = _method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3712
    call->_bci               = _bci;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3713
    call->_optimized_virtual = _optimized_virtual;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3714
    call->_tf                = _tf;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3715
    call->_entry_point       = _entry_point;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3716
    call->_cnt               = _cnt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3717
    call->_argsize           = _argsize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3718
    call->_oop_map           = _oop_map;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3719
    call->_jvms              = _jvms;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3720
    call->_jvmadj            = _jvmadj;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3721
    call->_in_rms            = _in_rms;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3722
    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
  3723
    call->_override_symbolic_info = _override_symbolic_info;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3724
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3725
    // New call needs all inputs of old call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3726
    // Req...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3727
    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
  3728
      // The expanded node does not need toc any more.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3729
      // 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
  3730
      // 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
  3731
      // 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
  3732
      if (i == mach_constant_base_node_input()) {
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3733
        call->add_req(loadConLNodes_IC._last);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3734
      } else {
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3735
        call->add_req(in(i));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3736
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3737
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3738
    // ...as well as prec
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3739
    for (uint i = req(); i < len(); ++i) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3740
      call->add_prec(in(i));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3741
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3742
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3743
    // Remember nodes loading the inline cache into r19.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3744
    call->_load_ic_hi_node = loadConLNodes_IC._large_hi;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3745
    call->_load_ic_node    = loadConLNodes_IC._small;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3746
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3747
    // Operands for new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3748
    call->_opnds[0] = _opnds[0];
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3749
    call->_opnds[1] = _opnds[1];
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3750
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3751
    // Only the inline cache is associated with a register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3752
    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
  3753
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3754
    // Push new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3755
    if (loadConLNodes_IC._large_hi) nodes->push(loadConLNodes_IC._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3756
    if (loadConLNodes_IC._last)     nodes->push(loadConLNodes_IC._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3757
    nodes->push(call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3758
  %}
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
  // Compound version of call dynamic
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3761
  // 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
  3762
  // In the code we have to use $constanttablebase.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3763
  enc_class enc_java_dynamic_call(method meth, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3764
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3765
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3766
    int start_offset = __ offset();
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
    Register Rtoc = (ra_) ? $constanttablebase : R2_TOC;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3769
#if 0
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3770
    int vtable_index = this->_vtable_index;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3771
    if (_vtable_index < 0) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3772
      // Must be invalid_vtable_index, not nonvirtual_vtable_index.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3773
      assert(_vtable_index == Method::invalid_vtable_index, "correct sentinel value");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3774
      Register ic_reg = as_Register(Matcher::inline_cache_reg_encode());
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3775
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3776
      // 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
  3777
      address virtual_call_meta_addr = __ pc();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3778
      // Load a clear inline cache.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  3779
      AddressLiteral empty_ic((address) Universe::non_oop_word());
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3780
      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
  3781
      if (!success) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3782
        ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3783
        return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3784
      }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3785
      // CALL to fixup routine.  Fixup routine uses ScopeDesc info
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3786
      // 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
  3787
      __ relocate(virtual_call_Relocation::spec(virtual_call_meta_addr));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3788
      emit_call_with_trampoline_stub(_masm, (address)$meth$$method, relocInfo::none);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3789
      assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3790
             "Fix constant in ret_addr_offset()");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3791
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3792
      assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3793
      // Go thru the vtable. Get receiver klass. Receiver already
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3794
      // 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
  3795
      // interpreter expects method in R19_method.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3796
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3797
      __ load_klass(R11_scratch1, R3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3798
35899
0dbc821628fc 8148047: Move the vtable length field to Klass
mgerdin
parents: 35871
diff changeset
  3799
      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
  3800
      int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3801
      __ li(R19_method, v_off);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3802
      __ ldx(R19_method/*method oop*/, R19_method/*method offset*/, R11_scratch1/*class*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3803
      // NOTE: for vtable dispatches, the vtable entry will never be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3804
      // null. However it may very well end up in handle_wrong_method
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3805
      // if the method is abstract for the particular class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3806
      __ ld(R11_scratch1, in_bytes(Method::from_compiled_offset()), R19_method);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3807
      // Call target. Either compiled code or C2I adapter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3808
      __ mtctr(R11_scratch1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3809
      __ bctrl();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3810
      if (((MachCallDynamicJavaNode*)this)->ret_addr_offset() != __ offset() - start_offset) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3811
        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
  3812
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3813
      assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3814
             "Fix constant in ret_addr_offset()");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3815
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3816
#endif
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3817
    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
  3818
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3819
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3820
  // a runtime call
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3821
  enc_class enc_java_to_runtime_call (method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3822
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3823
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3824
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3825
    const address start_pc = __ pc();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3826
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3827
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3828
    address entry= !($meth$$method) ? NULL : (address)$meth$$method;
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3829
    __ call_c(entry, relocInfo::runtime_call_type);
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3830
#else
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3831
    // The function we're going to call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3832
    FunctionDescriptor fdtemp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3833
    const FunctionDescriptor* fd = !($meth$$method) ? &fdtemp : (FunctionDescriptor*)$meth$$method;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3834
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3835
    Register Rtoc = R12_scratch2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3836
    // Calculate the method's TOC.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3837
    __ calculate_address_from_global_toc(Rtoc, __ method_toc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3838
    // 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
  3839
    // pool entries; call_c_using_toc will optimize the call.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3840
    bool success = __ call_c_using_toc(fd, relocInfo::runtime_call_type, Rtoc);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3841
    if (!success) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3842
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3843
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  3844
    }
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3845
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3846
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3847
    // Check the ret_addr_offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3848
    assert(((MachCallRuntimeNode*)this)->ret_addr_offset() ==  __ last_calls_return_pc() - start_pc,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3849
           "Fix constant in ret_addr_offset()");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3850
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3851
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3852
  // Move to ctr for leaf call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3853
  // This enc_class is needed so that scheduler gets proper
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3854
  // input mapping for latency computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3855
  enc_class enc_leaf_call_mtctr(iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3856
    // TODO: PPC port $archOpcode(ppc64Opcode_mtctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3857
    MacroAssembler _masm(&cbuf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3858
    __ mtctr($src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3859
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3860
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3861
  // Postalloc expand emitter for runtime leaf calls.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3862
  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
  3863
    loadConLNodesTuple loadConLNodes_Entry;
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3864
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3865
    jlong entry_address = (jlong) this->entry_point();
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3866
    assert(entry_address, "need address here");
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3867
    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
  3868
                                                    OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3869
#else
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3870
    // Get the struct that describes the function we are about to call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3871
    FunctionDescriptor* fd = (FunctionDescriptor*) this->entry_point();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3872
    assert(fd, "need fd here");
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3873
    jlong entry_address = (jlong) fd->entry();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3874
    // new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3875
    loadConLNodesTuple loadConLNodes_Env;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3876
    loadConLNodesTuple loadConLNodes_Toc;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3877
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3878
    // Create nodes and operands for loading the entry point.
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3879
    loadConLNodes_Entry = loadConLNodesTuple_create(ra_, n_toc, new immLOper(entry_address),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3880
                                                    OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3881
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3882
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3883
    // Create nodes and operands for loading the env pointer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3884
    if (fd->env() != NULL) {
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3885
      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
  3886
                                                    OptoReg::Name(R11_H_num), OptoReg::Name(R11_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3887
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3888
      loadConLNodes_Env._large_hi = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3889
      loadConLNodes_Env._large_lo = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3890
      loadConLNodes_Env._small    = NULL;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3891
      loadConLNodes_Env._last = new loadConL16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3892
      loadConLNodes_Env._last->_opnds[0] = new iRegLdstOper();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3893
      loadConLNodes_Env._last->_opnds[1] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3894
      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
  3895
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3896
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3897
    // Create nodes and operands for loading the Toc point.
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25715
diff changeset
  3898
    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
  3899
                                                  OptoReg::Name(R2_H_num), OptoReg::Name(R2_num));
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3900
#endif // ABI_ELFv2
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3901
    // mtctr node
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3902
    MachNode *mtctr = new CallLeafDirect_mtctrNode();
22861
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
    assert(loadConLNodes_Entry._last != NULL, "entry must exist");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3905
    mtctr->add_req(0, loadConLNodes_Entry._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3906
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3907
    mtctr->_opnds[0] = new iRegLdstOper();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3908
    mtctr->_opnds[1] = new iRegLdstOper();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3909
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3910
    // call node
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3911
    MachCallLeafNode *call = new CallLeafDirectNode();
22861
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
    call->_opnds[0] = _opnds[0];
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  3914
    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
  3915
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3916
    // Make the new call node look like the old one.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3917
    call->_name        = _name;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3918
    call->_tf          = _tf;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3919
    call->_entry_point = _entry_point;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3920
    call->_cnt         = _cnt;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3921
    call->_argsize     = _argsize;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3922
    call->_oop_map     = _oop_map;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3923
    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
  3924
    call->_jvms        = NULL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3925
    call->_jvmadj      = _jvmadj;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3926
    call->_in_rms      = _in_rms;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3927
    call->_nesting     = _nesting;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3928
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
    // New call needs all inputs of old call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3931
    // Req...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3932
    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
  3933
      if (i != mach_constant_base_node_input()) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3934
        call->add_req(in(i));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3935
      }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3936
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3937
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3938
    // These must be reqired edges, as the registers are live up to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3939
    // 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
  3940
    call->add_req(mtctr);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3941
#if !defined(ABI_ELFv2)
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3942
    call->add_req(loadConLNodes_Env._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3943
    call->add_req(loadConLNodes_Toc._last);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3944
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3945
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3946
    // ...as well as prec
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3947
    for (uint i = req(); i < len(); ++i) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3948
      call->add_prec(in(i));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3949
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3950
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3951
    // registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3952
    ra_->set1(mtctr->_idx, OptoReg::Name(SR_CTR_num));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3953
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3954
    // Insert the new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3955
    if (loadConLNodes_Entry._large_hi) nodes->push(loadConLNodes_Entry._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3956
    if (loadConLNodes_Entry._last)     nodes->push(loadConLNodes_Entry._last);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3957
#if !defined(ABI_ELFv2)
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3958
    if (loadConLNodes_Env._large_hi)   nodes->push(loadConLNodes_Env._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3959
    if (loadConLNodes_Env._last)       nodes->push(loadConLNodes_Env._last);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3960
    if (loadConLNodes_Toc._large_hi)   nodes->push(loadConLNodes_Toc._large_hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3961
    if (loadConLNodes_Toc._last)       nodes->push(loadConLNodes_Toc._last);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  3962
#endif
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3963
    nodes->push(mtctr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3964
    nodes->push(call);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3968
//----------FRAME--------------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3969
// Definition of frame structure and management information.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3970
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3971
frame %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3972
  // 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
  3973
  stack_direction(TOWARDS_LOW);
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
  // These two registers define part of the calling convention between
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3976
  // compiled code and the interpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3977
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  3978
  // Inline Cache Register or method for I2C.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3979
  inline_cache_reg(R19); // R19_method
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3980
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3981
  // Method Oop Register when calling interpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3982
  interpreter_method_oop_reg(R19); // R19_method
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
  // Optional: name the operand used by cisc-spilling to access
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3985
  // [stack_pointer + offset].
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3986
  cisc_spilling_operand_name(indOffset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3987
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3988
  // Number of stack slots consumed by a Monitor enter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3989
  sync_stack_slots((frame::jit_monitor_size / VMRegImpl::stack_slot_size));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3990
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3991
  // Compiled code's Frame Pointer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3992
  frame_pointer(R1); // R1_SP
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
  // Interpreter stores its frame pointer in a register which is
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3995
  // stored to the stack by I2CAdaptors. I2CAdaptors convert from
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3996
  // interpreted java to compiled java.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3997
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3998
  // R14_state holds pointer to caller's cInterpreter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  3999
  interpreter_frame_pointer(R14); // R14_state
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4001
  stack_alignment(frame::alignment_in_bytes);
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
  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
  4004
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4005
  // Number of outgoing stack slots killed above the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4006
  // out_preserve_stack_slots for calls to C. Supports the var-args
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4007
  // backing area for register parms.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4008
  //
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22927
diff changeset
  4009
  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
  4010
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4011
  // The after-PROLOG location of the return address. Location of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4012
  // return address specifies a type (REG or STACK) and a number
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4013
  // representing the register number (i.e. - use a register name) or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4014
  // stack slot.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4015
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4016
  // A: Link register is stored in stack slot ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4017
  // 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
  4018
  // 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
  4019
  //    at the end of the prolog.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4020
  // B: We use R20, now.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4021
  //return_addr(REG R20);
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
  // G: After reading the comments made by all the luminaries on their
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4024
  //    failure to tell the compiler where the return address really is,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4025
  //    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
  4026
  //    4 what apparently works and saves us some spills.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4027
  return_addr(STACK 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4028
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4029
  // This is the body of the function
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4030
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4031
  // void Matcher::calling_convention(OptoRegPair* sig, // array of ideal regs
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4032
  //                                  uint length,      // length of array
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4033
  //                                  bool is_outgoing)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4034
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4035
  // The `sig' array is to be updated. sig[j] represents the location
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4036
  // of the j-th argument, either a register or a stack slot.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4037
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4038
  // Comment taken from i486.ad:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4039
  // Body of function which returns an integer array locating
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4040
  // arguments either in registers or in stack slots. Passed an array
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4041
  // of ideal registers called "sig" and a "length" count. Stack-slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4042
  // offsets are based on outgoing arguments, i.e. a CALLER setting up
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4043
  // arguments for a CALLEE. Incoming stack arguments are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4044
  // automatically biased by the preserve_stack_slots field above.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4045
  calling_convention %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4046
    // No difference between ingoing/outgoing. Just pass false.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4047
    SharedRuntime::java_calling_convention(sig_bt, regs, length, false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4048
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4049
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4050
  // Comment taken from i486.ad:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4051
  // Body of function which returns an integer array locating
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4052
  // arguments either in registers or in stack slots. Passed an array
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4053
  // of ideal registers called "sig" and a "length" count. Stack-slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4054
  // offsets are based on outgoing arguments, i.e. a CALLER setting up
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4055
  // arguments for a CALLEE. Incoming stack arguments are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4056
  // automatically biased by the preserve_stack_slots field above.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4057
  c_calling_convention %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4058
    // This is obviously always outgoing.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4059
    // C argument in register AND stack slot.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4060
    (void) SharedRuntime::c_calling_convention(sig_bt, regs, /*regs2=*/NULL, length);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4061
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4062
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4063
  // Location of native (C/C++) and interpreter return values. This
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4064
  // 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
  4065
  // values are actually returned from native calls in O0:O1 and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4066
  // returned to the interpreter in I0:I1. The copying to and from
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4067
  // the register pairs is done by the appropriate call and epilog
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4068
  // opcodes. This simplifies the register allocator.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4069
  c_return_value %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4070
    assert((ideal_reg >= Op_RegI && ideal_reg <= Op_RegL) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4071
            (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
  4072
            "only return normal values");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4073
    // 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
  4074
    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
  4075
    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
  4076
    return OptoRegPair(typeToRegHi[ideal_reg], typeToRegLo[ideal_reg]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4077
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4078
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4079
  // Location of compiled Java return values.  Same as C
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4080
  return_value %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4081
    assert((ideal_reg >= Op_RegI && ideal_reg <= Op_RegL) ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4082
            (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
  4083
            "only return normal values");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4084
    // 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
  4085
    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
  4086
    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
  4087
    return OptoRegPair(typeToRegHi[ideal_reg], typeToRegLo[ideal_reg]);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4088
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4089
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4090
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4091
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4092
//----------ATTRIBUTES---------------------------------------------------------
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
//----------Operand Attributes-------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4095
op_attrib op_cost(1);          // Required cost attribute.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4096
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4097
//----------Instruction Attributes---------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4098
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4099
// Cost attribute. required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4100
ins_attrib ins_cost(DEFAULT_COST);
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
// Is this instruction a non-matching short branch variant of some
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4103
// long branch? Not required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4104
ins_attrib ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4105
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4106
ins_attrib ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4107
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4108
// Number of constants.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4109
// This instruction uses the given number of constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4110
// (optional attribute).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4111
// This is needed to determine in time whether the constant pool will
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4112
// exceed 4000 entries. Before postalloc_expand the overall number of constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4113
// is determined. It's also used to compute the constant pool size
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4114
// in Output().
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4115
ins_attrib ins_num_consts(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4116
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4117
// Required alignment attribute (must be a power of 2) specifies the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4118
// alignment that some part of the instruction (not necessarily the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4119
// start) requires. If > 1, a compute_padding() function must be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4120
// provided for the instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4121
ins_attrib ins_alignment(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4122
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4123
// Enforce/prohibit rematerializations.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4124
// - If an instruction is attributed with 'ins_cannot_rematerialize(true)'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4125
//   then rematerialization of that instruction is prohibited and the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4126
//   instruction's value will be spilled if necessary.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4127
//   Causes that MachNode::rematerialize() returns false.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4128
// - If an instruction is attributed with 'ins_should_rematerialize(true)'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4129
//   then rematerialization should be enforced and a copy of the instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4130
//   should be inserted if possible; rematerialization is not guaranteed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4131
//   Note: this may result in rematerializations in front of every use.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4132
//   Causes that MachNode::rematerialize() can return true.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4133
// (optional attribute)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4134
ins_attrib ins_cannot_rematerialize(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4135
ins_attrib ins_should_rematerialize(false);
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
// Instruction has variable size depending on alignment.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4138
ins_attrib ins_variable_size_depending_on_alignment(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4139
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4140
// Instruction is a nop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4141
ins_attrib ins_is_nop(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4142
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4143
// Instruction is mapped to a MachIfFastLock node (instead of MachFastLock).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4144
ins_attrib ins_use_mach_if_fast_lock_node(false);
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
// Field for the toc offset of a constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4147
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4148
// 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
  4149
// 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
  4150
// 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
  4151
// With postalloc expand, we get two nodes that require the same offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4152
// 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
  4153
// when the constant is added to the constant pool during emitting.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4154
// 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
  4155
// 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
  4156
// the offset from there when it gets encoded.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4157
ins_attrib ins_field_const_toc_offset(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4158
ins_attrib ins_field_const_toc_offset_hi_node(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4159
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4160
// A field that can hold the instructions offset in the code buffer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4161
// Set in the nodes emitter.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4162
ins_attrib ins_field_cbuf_insts_offset(-1);
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
// Fields for referencing a call's load-IC-node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4165
// 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
  4166
// use two nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4167
ins_attrib ins_field_load_ic_hi_node(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4168
ins_attrib ins_field_load_ic_node(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4169
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4170
//----------OPERANDS-----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4171
// Operand definitions must precede instruction definitions for correct
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4172
// parsing in the ADLC because operands constitute user defined types
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4173
// which are used in instruction definitions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4174
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4175
// Formats are generated automatically for constants and base registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4176
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  4177
operand vecX() %{
47584
b02ea7eb7d93 8188757: PPC64: Disable VSR52-63 in ppc.ad
mhorie
parents: 47583
diff changeset
  4178
  constraint(ALLOC_IN_RC(vs_reg));
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  4179
  match(VecX);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  4180
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  4181
  format %{ %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  4182
  interface(REG_INTER);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  4183
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  4184
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4185
//----------Simple Operands----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4186
// Immediate Operands
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4187
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4188
// Integer Immediate: 32-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4189
operand immI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4190
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4191
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4192
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4193
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4194
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4195
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4196
operand immI8() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4197
  predicate(Assembler::is_simm(n->get_int(), 8));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4198
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4199
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4200
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4201
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4202
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4203
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4204
// Integer Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4205
operand immI16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4206
  predicate(Assembler::is_simm(n->get_int(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4207
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4208
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4209
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4210
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4211
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4212
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4213
// Integer Immediate: 32-bit, where lowest 16 bits are 0x0000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4214
operand immIhi16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4215
  predicate(((n->get_int() & 0xffff0000) != 0) && ((n->get_int() & 0xffff) == 0));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4216
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4217
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4218
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4219
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4220
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4221
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4222
operand immInegpow2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4223
  predicate(is_power_of_2_long((jlong) (julong) (juint) (-(n->get_int()))));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4224
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4225
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4226
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4227
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4228
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4229
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4230
operand immIpow2minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4231
  predicate(is_power_of_2_long((((jlong) (n->get_int()))+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4232
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4233
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4234
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4235
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4236
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4237
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4238
operand immIpowerOf2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4239
  predicate(is_power_of_2_long((((jlong) (julong) (juint) (n->get_int())))));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4240
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4241
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4242
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4243
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4244
%}
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
// Unsigned Integer Immediate: the values 0-31
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4247
operand uimmI5() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4248
  predicate(Assembler::is_uimm(n->get_int(), 5));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4249
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4250
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4251
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4252
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4255
// Unsigned Integer Immediate: 6-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4256
operand uimmI6() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4257
  predicate(Assembler::is_uimm(n->get_int(), 6));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4258
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4259
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4260
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4261
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4262
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4263
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4264
// Unsigned Integer Immediate:  6-bit int, greater than 32
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4265
operand uimmI6_ge32() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4266
  predicate(Assembler::is_uimm(n->get_int(), 6) && n->get_int() >= 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4267
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4268
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4269
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4270
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4271
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4272
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4273
// Unsigned Integer Immediate: 15-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4274
operand uimmI15() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4275
  predicate(Assembler::is_uimm(n->get_int(), 15));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4276
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4277
  op_cost(0);
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(CONST_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
// Unsigned Integer Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4283
operand uimmI16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4284
  predicate(Assembler::is_uimm(n->get_int(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4285
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4286
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4287
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4288
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4289
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4290
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4291
// constant 'int 0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4292
operand immI_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4293
  predicate(n->get_int() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4294
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4295
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4296
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4297
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4298
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4299
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4300
// constant 'int 1'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4301
operand immI_1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4302
  predicate(n->get_int() == 1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4303
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4304
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4305
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4306
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4307
%}
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
// constant 'int -1'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4310
operand immI_minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4311
  predicate(n->get_int() == -1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4312
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4313
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4314
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4315
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4316
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4317
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4318
// int value 16.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4319
operand immI_16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4320
  predicate(n->get_int() == 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4321
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4322
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4323
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4324
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4325
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4326
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4327
// int value 24.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4328
operand immI_24() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4329
  predicate(n->get_int() == 24);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4330
  match(ConI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4331
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4332
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4333
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4334
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4335
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4336
// Compressed oops constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4337
// Pointer Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4338
operand immN() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4339
  match(ConN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4340
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4341
  op_cost(10);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4342
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4343
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4344
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4345
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4346
// NULL Pointer Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4347
operand immN_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4348
  predicate(n->get_narrowcon() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4349
  match(ConN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4350
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4351
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4352
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4353
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4356
// Compressed klass constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4357
operand immNKlass() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4358
  match(ConNKlass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4359
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4360
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4361
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4362
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4363
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4364
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4365
// This operand can be used to avoid matching of an instruct
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4366
// with chain rule.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4367
operand immNKlass_NM() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4368
  match(ConNKlass);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4369
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4370
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4371
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4372
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4373
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4374
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4375
// Pointer Immediate: 64-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4376
operand immP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4377
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4378
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4379
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4380
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4381
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4382
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4383
// Operand to avoid match of loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4384
// This operand can be used to avoid matching of an instruct
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4385
// with chain rule.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4386
operand immP_NM() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4387
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4388
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4389
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4390
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4391
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4392
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4393
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4394
// costant 'pointer 0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4395
operand immP_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4396
  predicate(n->get_ptr() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4397
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4398
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4399
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4400
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4401
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4402
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4403
// pointer 0x0 or 0x1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4404
operand immP_0or1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4405
  predicate((n->get_ptr() == 0) || (n->get_ptr() == 1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4406
  match(ConP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4407
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4408
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4409
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4410
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4411
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4412
operand immL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4413
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4414
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4415
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4416
  interface(CONST_INTER);
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
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4419
operand immLmax30() %{
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4420
  predicate((n->get_long() <= 30));
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4421
  match(ConL);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4422
  op_cost(0);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4423
  format %{ %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4424
  interface(CONST_INTER);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4425
%}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
  4426
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4427
// Long Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4428
operand immL16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4429
  predicate(Assembler::is_simm(n->get_long(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4430
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4431
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4432
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4433
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4434
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4435
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4436
// Long Immediate: 16-bit, 4-aligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4437
operand immL16Alg4() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4438
  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
  4439
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4440
  op_cost(0);
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(CONST_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
// Long Immediate: 32-bit, where lowest 16 bits are 0x0000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4446
operand immL32hi16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4447
  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
  4448
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4449
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4450
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4451
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4454
// Long Immediate: 32-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4455
operand immL32() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4456
  predicate(Assembler::is_simm(n->get_long(), 32));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4457
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4458
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4459
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4460
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4461
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4462
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4463
// Long Immediate: 64-bit, where highest 16 bits are not 0x0000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4464
operand immLhighest16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4465
  predicate((n->get_long() & 0xffff000000000000L) != 0L && (n->get_long() & 0x0000ffffffffffffL) == 0L);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4466
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4467
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4468
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4469
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4470
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4471
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4472
operand immLnegpow2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4473
  predicate(is_power_of_2_long((jlong)-(n->get_long())));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4474
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4475
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4476
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4477
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4478
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4479
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4480
operand immLpow2minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4481
  predicate(is_power_of_2_long((((jlong) (n->get_long()))+1)) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4482
            (n->get_long() != (jlong)0xffffffffffffffffL));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4483
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4484
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4485
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4486
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4487
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4488
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4489
// constant 'long 0'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4490
operand immL_0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4491
  predicate(n->get_long() == 0L);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4492
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4493
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4494
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4495
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4496
%}
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
// constat ' long -1'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4499
operand immL_minus1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4500
  predicate(n->get_long() == -1L);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4501
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4502
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4503
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4504
  interface(CONST_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4507
// Long Immediate: low 32-bit mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4508
operand immL_32bits() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4509
  predicate(n->get_long() == 0xFFFFFFFFL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4510
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4511
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4512
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4513
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4514
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4515
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4516
// Unsigned Long Immediate: 16-bit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4517
operand uimmL16() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4518
  predicate(Assembler::is_uimm(n->get_long(), 16));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4519
  match(ConL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4520
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4521
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4522
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4523
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4524
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4525
// Float Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4526
operand immF() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4527
  match(ConF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4528
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4529
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4530
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4531
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4532
29581
b8d83fef0c8e 8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents: 28954
diff changeset
  4533
// Float Immediate: +0.0f.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4534
operand immF_0() %{
29581
b8d83fef0c8e 8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents: 28954
diff changeset
  4535
  predicate(jint_cast(n->getf()) == 0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4536
  match(ConF);
29581
b8d83fef0c8e 8074869: C2 code generator can replace -0.0f with +0.0f on Linux
zmajo
parents: 28954
diff changeset
  4537
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4538
  op_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4539
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4540
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4541
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4542
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4543
// Double Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4544
operand immD() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4545
  match(ConD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4546
  op_cost(40);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4547
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4548
  interface(CONST_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4549
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4550
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4551
// Integer Register Operands
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4552
// Integer Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4553
// See definition of reg_class bits32_reg_rw.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4554
operand iRegIdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4555
  constraint(ALLOC_IN_RC(bits32_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4556
  match(RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4557
  match(rscratch1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4558
  match(rscratch2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4559
  match(rarg1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4560
  match(rarg2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4561
  match(rarg3RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4562
  match(rarg4RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4563
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4564
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4565
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4567
// Integer Source Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4568
// See definition of reg_class bits32_reg_ro.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4569
operand iRegIsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4570
  constraint(ALLOC_IN_RC(bits32_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4571
  match(RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4572
  match(rscratch1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4573
  match(rscratch2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4574
  match(rarg1RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4575
  match(rarg2RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4576
  match(rarg3RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4577
  match(rarg4RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4578
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4579
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4580
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4581
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4582
operand rscratch1RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4583
  constraint(ALLOC_IN_RC(rscratch1_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4584
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4585
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4586
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4587
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4588
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4589
operand rscratch2RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4590
  constraint(ALLOC_IN_RC(rscratch2_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4591
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4592
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4593
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4594
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4595
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4596
operand rarg1RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4597
  constraint(ALLOC_IN_RC(rarg1_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4598
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4599
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4600
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4601
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4602
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4603
operand rarg2RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4604
  constraint(ALLOC_IN_RC(rarg2_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4605
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4606
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4607
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4608
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4609
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4610
operand rarg3RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4611
  constraint(ALLOC_IN_RC(rarg3_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4612
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4613
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4614
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4615
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4616
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4617
operand rarg4RegI() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4618
  constraint(ALLOC_IN_RC(rarg4_bits32_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4619
  match(iRegIdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4620
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4621
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4622
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4623
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4624
operand rarg1RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4625
  constraint(ALLOC_IN_RC(rarg1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4626
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4627
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4628
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4629
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4630
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4631
operand rarg2RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4632
  constraint(ALLOC_IN_RC(rarg2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4633
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4634
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4635
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4636
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4637
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4638
operand rarg3RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4639
  constraint(ALLOC_IN_RC(rarg3_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4640
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4641
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4642
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4643
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4644
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4645
operand rarg4RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4646
  constraint(ALLOC_IN_RC(rarg4_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4647
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4648
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4649
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4650
%}
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
// Pointer Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4653
// See definition of reg_class bits64_reg_rw.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4654
operand iRegPdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4655
  constraint(ALLOC_IN_RC(bits64_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4656
  match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4657
  match(rscratch1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4658
  match(rscratch2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4659
  match(rarg1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4660
  match(rarg2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4661
  match(rarg3RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4662
  match(rarg4RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4663
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4664
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4665
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4666
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4667
// Pointer Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4668
// Operand not using r11 and r12 (killed in epilog).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4669
operand iRegPdstNoScratch() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4670
  constraint(ALLOC_IN_RC(bits64_reg_leaf_call));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4671
  match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4672
  match(rarg1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4673
  match(rarg2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4674
  match(rarg3RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4675
  match(rarg4RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4676
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4677
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4678
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4679
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4680
// Pointer Source Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4681
// See definition of reg_class bits64_reg_ro.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4682
operand iRegPsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4683
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4684
  match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4685
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4686
  match(rscratch1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4687
  match(rscratch2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4688
  match(rarg1RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4689
  match(rarg2RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4690
  match(rarg3RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4691
  match(rarg4RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4692
  match(threadRegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4693
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4694
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4695
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4696
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4697
// Thread operand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4698
operand threadRegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4699
  constraint(ALLOC_IN_RC(thread_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4700
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4701
  format %{ "R16" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4702
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4703
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4704
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4705
operand rscratch1RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4706
  constraint(ALLOC_IN_RC(rscratch1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4707
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4708
  format %{ "R11" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4709
  interface(REG_INTER);
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
operand rscratch2RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4713
  constraint(ALLOC_IN_RC(rscratch2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4714
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4715
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4716
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4717
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4718
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4719
operand rarg1RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4720
  constraint(ALLOC_IN_RC(rarg1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4721
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4722
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4723
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4724
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4725
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4726
operand rarg2RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4727
  constraint(ALLOC_IN_RC(rarg2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4728
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4729
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4730
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4731
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4732
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4733
operand rarg3RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4734
  constraint(ALLOC_IN_RC(rarg3_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4735
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4736
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4737
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4738
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4739
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4740
operand rarg4RegP() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4741
  constraint(ALLOC_IN_RC(rarg4_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4742
  match(iRegPdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4743
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4744
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4745
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4746
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4747
operand iRegNsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4748
  constraint(ALLOC_IN_RC(bits32_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4749
  match(RegN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4750
  match(iRegNdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4751
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4752
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4753
  interface(REG_INTER);
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 iRegNdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4757
  constraint(ALLOC_IN_RC(bits32_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4758
  match(RegN);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4759
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4760
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4761
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4762
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4763
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4764
// Long Destination Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4765
// See definition of reg_class bits64_reg_rw.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4766
operand iRegLdst() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4767
  constraint(ALLOC_IN_RC(bits64_reg_rw));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4768
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4769
  match(rscratch1RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4770
  match(rscratch2RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4771
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4772
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4773
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4774
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4775
// Long Source Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4776
// See definition of reg_class bits64_reg_ro.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4777
operand iRegLsrc() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4778
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4779
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4780
  match(iRegLdst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4781
  match(rscratch1RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4782
  match(rscratch2RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4783
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4784
  interface(REG_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4787
// Special operand for ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4788
operand iRegL2Isrc(iRegLsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4789
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4790
  match(ConvL2I reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4791
  format %{ "ConvL2I($reg)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4792
  interface(REG_INTER)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4793
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4794
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4795
operand rscratch1RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4796
  constraint(ALLOC_IN_RC(rscratch1_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4797
  match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4798
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4799
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4800
%}
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
operand rscratch2RegL() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4803
  constraint(ALLOC_IN_RC(rscratch2_bits64_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4804
  match(RegL);
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(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4807
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4808
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4809
// Condition Code Flag Registers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4810
operand flagsReg() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4811
  constraint(ALLOC_IN_RC(int_flags));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4812
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4813
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4814
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4815
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4816
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4817
operand flagsRegSrc() %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4818
  constraint(ALLOC_IN_RC(int_flags_ro));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4819
  match(RegFlags);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4820
  match(flagsReg);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4821
  match(flagsRegCR0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4822
  format %{ %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4823
  interface(REG_INTER);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4824
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4825
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4826
// Condition Code Flag Register CR0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4827
operand flagsRegCR0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4828
  constraint(ALLOC_IN_RC(int_flags_CR0));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4829
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4830
  format %{ "CR0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4831
  interface(REG_INTER);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4834
operand flagsRegCR1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4835
  constraint(ALLOC_IN_RC(int_flags_CR1));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4836
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4837
  format %{ "CR1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4838
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4839
%}
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
operand flagsRegCR6() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4842
  constraint(ALLOC_IN_RC(int_flags_CR6));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4843
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4844
  format %{ "CR6" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4845
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4846
%}
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
operand regCTR() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4849
  constraint(ALLOC_IN_RC(ctr_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4850
  // RegFlags should work. Introducing a RegSpecial type would cause a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4851
  // lot of changes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4852
  match(RegFlags);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4853
  format %{"SR_CTR" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4854
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4855
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4856
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4857
operand regD() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4858
  constraint(ALLOC_IN_RC(dbl_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4859
  match(RegD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4860
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4861
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4862
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4863
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4864
operand regF() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4865
  constraint(ALLOC_IN_RC(flt_reg));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4866
  match(RegF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4867
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4868
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4869
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4870
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4871
// Special Registers
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
// Method Register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4874
operand inline_cache_regP(iRegPdst reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4875
  constraint(ALLOC_IN_RC(r19_bits64_reg)); // inline_cache_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4876
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4877
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4878
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4879
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4880
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4881
operand compiler_method_oop_regP(iRegPdst reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4882
  constraint(ALLOC_IN_RC(rscratch1_bits64_reg)); // compiler_method_oop_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4883
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4884
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4885
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4886
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4887
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4888
operand interpreter_method_oop_regP(iRegPdst reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4889
  constraint(ALLOC_IN_RC(r19_bits64_reg)); // interpreter_method_oop_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4890
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4891
  format %{ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4892
  interface(REG_INTER);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4893
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4894
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4895
// Operands to remove register moves in unscaled mode.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4896
// 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
  4897
operand iRegP2N(iRegPsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4898
  predicate(false /* TODO: PPC port MatchDecodeNodes*/&& Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4899
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4900
  match(EncodeP reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4901
  format %{ "$reg" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4902
  interface(REG_INTER)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4903
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4904
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4905
operand iRegN2P(iRegNsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4906
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4907
  constraint(ALLOC_IN_RC(bits32_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4908
  match(DecodeN reg);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4909
  format %{ "$reg" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4910
  interface(REG_INTER)
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4911
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4912
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4913
operand iRegN2P_klass(iRegNsrc reg) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4914
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4915
  constraint(ALLOC_IN_RC(bits32_reg_ro));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4916
  match(DecodeNKlass reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4917
  format %{ "$reg" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4918
  interface(REG_INTER)
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4921
//----------Complex Operands---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4922
// Indirect Memory Reference
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4923
operand indirect(iRegPsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4924
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4925
  match(reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4926
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4927
  format %{ "[$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4928
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4929
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4930
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4931
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4932
    disp(0x0);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4935
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4936
// Indirect with Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4937
operand indOffset16(iRegPsrc reg, immL16 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4938
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4939
  match(AddP reg offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4940
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4941
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4942
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4943
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4944
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4945
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4946
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4947
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4948
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4949
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4950
// Indirect with 4-aligned Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4951
operand indOffset16Alg4(iRegPsrc reg, immL16Alg4 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4952
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4953
  match(AddP reg offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4954
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4955
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4956
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4957
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4958
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4959
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4960
    disp($offset);
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
//----------Complex Operands for Compressed OOPs-------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4965
// Compressed OOPs with narrow_oop_shift == 0.
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
// Indirect Memory Reference, compressed OOP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4968
operand indirectNarrow(iRegNsrc reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4969
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4970
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4971
  match(DecodeN reg);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4972
  op_cost(100);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4973
  format %{ "[$reg]" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4974
  interface(MEMORY_INTER) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4975
    base($reg);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4976
    index(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4977
    scale(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4978
    disp(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4979
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4980
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4981
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4982
operand indirectNarrow_klass(iRegNsrc reg) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4983
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  4984
  constraint(ALLOC_IN_RC(bits64_reg_ro));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4985
  match(DecodeNKlass reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4986
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4987
  format %{ "[$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4988
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4989
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4990
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4991
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4992
    disp(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4993
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4994
%}
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
// Indirect with Offset, compressed OOP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4997
operand indOffset16Narrow(iRegNsrc reg, immL16 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4998
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  4999
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5000
  match(AddP (DecodeN reg) offset);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5001
  op_cost(100);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5002
  format %{ "[$reg + $offset]" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5003
  interface(MEMORY_INTER) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5004
    base($reg);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5005
    index(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5006
    scale(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5007
    disp($offset);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5008
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5009
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5010
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5011
operand indOffset16Narrow_klass(iRegNsrc reg, immL16 offset) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5012
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5013
  constraint(ALLOC_IN_RC(bits64_reg_ro));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5014
  match(AddP (DecodeNKlass reg) offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5015
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5016
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5017
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5018
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5019
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5020
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5021
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5022
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5023
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5024
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5025
// Indirect with 4-aligned Offset, compressed OOP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5026
operand indOffset16NarrowAlg4(iRegNsrc reg, immL16Alg4 offset) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5027
  predicate(false /* TODO: PPC port MatchDecodeNodes*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5028
  constraint(ALLOC_IN_RC(bits64_reg_ro));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5029
  match(AddP (DecodeN reg) offset);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5030
  op_cost(100);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5031
  format %{ "[$reg + $offset]" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5032
  interface(MEMORY_INTER) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5033
    base($reg);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5034
    index(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5035
    scale(0x0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5036
    disp($offset);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5037
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5038
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5039
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5040
operand indOffset16NarrowAlg4_klass(iRegNsrc reg, immL16Alg4 offset) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5041
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5042
  constraint(ALLOC_IN_RC(bits64_reg_ro));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5043
  match(AddP (DecodeNKlass reg) offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5044
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5045
  format %{ "[$reg + $offset]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5046
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5047
    base($reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5048
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5049
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5050
    disp($offset);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5051
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5052
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5053
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5054
//----------Special Memory Operands--------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5055
// Stack Slot Operand
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
// This operand is used for loading and storing temporary values on
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5058
// the stack where a match requires a value to flow through memory.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5059
operand stackSlotI(sRegI reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5060
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5061
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5062
  //match(RegI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5063
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5064
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5065
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5066
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5067
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5068
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5069
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5070
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5071
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5072
operand stackSlotL(sRegL reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5073
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5074
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5075
  //match(RegL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5076
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5077
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5078
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5079
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5080
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5081
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5082
  %}
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5085
operand stackSlotP(sRegP reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5086
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5087
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5088
  //match(RegP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5089
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5090
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5091
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5092
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5093
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5094
    disp($reg);  // Stack Offset
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5095
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5096
%}
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
operand stackSlotF(sRegF reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5099
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5100
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5101
  //match(RegF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5102
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5103
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5104
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5105
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5106
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5107
    disp($reg);  // Stack Offset
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5110
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5111
operand stackSlotD(sRegD reg) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5112
  constraint(ALLOC_IN_RC(stack_slots));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5113
  op_cost(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5114
  //match(RegD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5115
  format %{ "[sp+$reg]" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5116
  interface(MEMORY_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5117
    base(0x1);   // R1_SP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5118
    index(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5119
    scale(0x0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5120
    disp($reg);  // Stack Offset
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5123
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5124
// Operands for expressing Control Flow
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5125
// NOTE: Label is a predefined operand which should not be redefined in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5126
//       the AD file. It is generically handled within the ADLC.
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
//----------Conditional Branch Operands----------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5129
// Comparison Op
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5130
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5131
// This is the operation of the comparison, and is limited to the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5132
// following set of codes: L (<), LE (<=), G (>), GE (>=), E (==), NE
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5133
// (!=).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5134
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5135
// Other attributes of the comparison, such as unsignedness, are specified
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5136
// by the comparison instruction that sets a condition code flags register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5137
// That result is represented by a flags operand whose subtype is appropriate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5138
// to the unsignedness (etc.) of the comparison.
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
// Later, the instruction which matches both the Comparison Op (a Bool) and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5141
// 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
  5142
// by matching a specific subtype of Bool operand below.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5143
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5144
// When used for floating point comparisons: unordered same as less.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5145
operand cmpOp() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5146
  match(Bool);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5147
  format %{ "" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5148
  interface(COND_INTER) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5149
                           // 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
  5150
                           //           BO          &  BI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5151
    equal(0xA);            // 10 10:   bcondCRbiIs1 & Condition::equal
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5152
    not_equal(0x2);        // 00 10:   bcondCRbiIs0 & Condition::equal
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5153
    less(0x8);             // 10 00:   bcondCRbiIs1 & Condition::less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5154
    greater_equal(0x0);    // 00 00:   bcondCRbiIs0 & Condition::less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5155
    less_equal(0x1);       // 00 01:   bcondCRbiIs0 & Condition::greater
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5156
    greater(0x9);          // 10 01:   bcondCRbiIs1 & Condition::greater
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5157
    overflow(0xB);         // 10 11:   bcondCRbiIs1 & Condition::summary_overflow
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5158
    no_overflow(0x3);      // 00 11:   bcondCRbiIs0 & Condition::summary_overflow
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5159
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5160
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5161
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5162
//----------OPERAND CLASSES----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5163
// Operand Classes are groups of operands that are used to simplify
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5164
// instruction definitions by not requiring the AD writer to specify
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5165
// seperate instructions for every form of operand when the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5166
// instruction accepts multiple operand types with the same basic
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5167
// encoding and format. The classic case of this is memory operands.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5168
// Indirect is not included since its use is limited to Compare & Swap.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5169
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5170
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
  5171
// Memory operand where offsets are 4-aligned. Required for ld, std.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5172
opclass memoryAlg4(indirect, indOffset16Alg4, indirectNarrow, indOffset16NarrowAlg4, indOffset16NarrowAlg4_klass);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5173
opclass indirectMemory(indirect, indirectNarrow);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5174
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5175
// Special opclass for I and ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5176
opclass iRegIsrc_iRegL2Isrc(iRegIsrc, iRegL2Isrc);
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
// Operand classes to match encode and decode. iRegN_P2N is only used
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5179
// for storeN. I have never seen an encode node elsewhere.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5180
opclass iRegN_P2N(iRegNsrc, iRegP2N);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5181
opclass iRegP_N2P(iRegPsrc, iRegN2P, iRegN2P_klass);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5182
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5183
//----------PIPELINE-----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5184
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5185
pipeline %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5186
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5187
// See J.M.Tendler et al. "Power4 system microarchitecture", IBM
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5188
// J. Res. & Dev., No. 1, Jan. 2002.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5189
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5190
//----------ATTRIBUTES---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5191
attributes %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5192
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5193
  // Power4 instructions are of fixed length.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5194
  fixed_size_instructions;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5195
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5196
  // TODO: if `bundle' means number of instructions fetched
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5197
  // per cycle, this is 8. If `bundle' means Power4 `group', that is
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5198
  // max instructions issued per cycle, this is 5.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5199
  max_instructions_per_bundle = 8;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5200
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5201
  // A Power4 instruction is 4 bytes long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5202
  instruction_unit_size = 4;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5203
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5204
  // The Power4 processor fetches 64 bytes...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5205
  instruction_fetch_unit_size = 64;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5206
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5207
  // ...in one line
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5208
  instruction_fetch_units = 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5209
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5210
  // Unused, list one so that array generated by adlc is not empty.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5211
  // Aix compiler chokes if _nop_count = 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5212
  nops(fxNop);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5213
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5214
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5215
//----------RESOURCES----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5216
// Resources are the functional units available to the machine
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5217
resources(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5218
   PPC_BR,         // branch unit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5219
   PPC_CR,         // condition unit
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5220
   PPC_FX1,        // integer arithmetic unit 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5221
   PPC_FX2,        // integer arithmetic unit 2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5222
   PPC_LDST1,      // load/store unit 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5223
   PPC_LDST2,      // load/store unit 2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5224
   PPC_FP1,        // float arithmetic unit 1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5225
   PPC_FP2,        // float arithmetic unit 2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5226
   PPC_LDST = PPC_LDST1 | PPC_LDST2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5227
   PPC_FX = PPC_FX1 | PPC_FX2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5228
   PPC_FP = PPC_FP1 | PPC_FP2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5229
 );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5230
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5231
//----------PIPELINE DESCRIPTION-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5232
// Pipeline Description specifies the stages in the machine's pipeline
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5233
pipe_desc(
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5234
   // Power4 longest pipeline path
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5235
   PPC_IF,   // instruction fetch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5236
   PPC_IC,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5237
   //PPC_BP, // branch prediction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5238
   PPC_D0,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5239
   PPC_D1,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5240
   PPC_D2,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5241
   PPC_D3,   // decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5242
   PPC_Xfer1,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5243
   PPC_GD,   // group definition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5244
   PPC_MP,   // map
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5245
   PPC_ISS,  // issue
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5246
   PPC_RF,   // resource fetch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5247
   PPC_EX1,  // execute (all units)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5248
   PPC_EX2,  // execute (FP, LDST)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5249
   PPC_EX3,  // execute (FP, LDST)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5250
   PPC_EX4,  // execute (FP)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5251
   PPC_EX5,  // execute (FP)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5252
   PPC_EX6,  // execute (FP)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5253
   PPC_WB,   // write back
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5254
   PPC_Xfer2,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5255
   PPC_CP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5256
 );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5257
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5258
//----------PIPELINE CLASSES---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5259
// Pipeline Classes describe the stages in which input and output are
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5260
// referenced by the hardware pipeline.
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
// Simple pipeline classes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5263
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5264
// Default pipeline class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5265
pipe_class pipe_class_default() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5266
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5267
  fixed_latency(2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5268
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5269
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5270
// Pipeline class for empty instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5271
pipe_class pipe_class_empty() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5272
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5273
  fixed_latency(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5274
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5275
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5276
// Pipeline class for compares.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5277
pipe_class pipe_class_compare() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5278
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5279
  fixed_latency(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5280
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5281
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5282
// Pipeline class for traps.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5283
pipe_class pipe_class_trap() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5284
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5285
  fixed_latency(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5286
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5287
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5288
// Pipeline class for memory operations.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5289
pipe_class pipe_class_memory() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5290
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5291
  fixed_latency(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5292
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5293
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5294
// Pipeline class for call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5295
pipe_class pipe_class_call() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5296
  single_instruction;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5297
  fixed_latency(100);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5298
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5299
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5300
// Define the class for the Nop node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5301
define %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5302
   MachNop = pipe_class_default;
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5306
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5307
//----------INSTRUCTIONS-------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5308
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5309
// Naming of instructions:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5310
//   opA_operB / opA_operB_operC:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5311
//     Operation 'op' with one or two source operands 'oper'. Result
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5312
//     type is A, source operand types are B and C.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5313
//     Iff A == B == C, B and C are left out.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5314
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5315
// The instructions are ordered according to the following scheme:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5316
//  - loads
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5317
//  - load constants
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5318
//  - prefetch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5319
//  - store
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5320
//  - encode/decode
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5321
//  - membar
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5322
//  - conditional moves
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5323
//  - compare & swap
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5324
//  - arithmetic and logic operations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5325
//    * int: Add, Sub, Mul, Div, Mod
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5326
//    * int: lShift, arShift, urShift, rot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5327
//    * float: Add, Sub, Mul, Div
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5328
//    * and, or, xor ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5329
//  - register moves: float <-> int, reg <-> stack, repl
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5330
//  - cast (high level type cast, XtoP, castPP, castII, not_null etc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5331
//  - conv (low level type cast requiring bit changes (sign extend etc)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5332
//  - compares, range & zero checks.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5333
//  - branches
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5334
//  - complex operations, intrinsics, min, max, replicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5335
//  - lock
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5336
//  - Calls
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5337
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5338
// If there are similar instructions with different types they are sorted:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5339
// int before float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5340
// small before big
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5341
// signed before unsigned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5342
// e.g., loadS before loadUS before loadI before loadF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5343
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5344
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5345
//----------Load/Store Instructions--------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5346
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5347
//----------Load Instructions--------------------------------------------------
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
// Converts byte to int.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5350
// 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
  5351
// reuses the 'amount' operand, but adlc expects that operand specification
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5352
// and operands in match rule are equivalent.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5353
instruct convB2I_reg_2(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5354
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5355
  format %{ "EXTSB   $dst, $src \t// byte->int" %}
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 %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5358
    // TODO: PPC port $archOpcode(ppc64Opcode_extsb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5359
    __ extsb($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5364
instruct loadUB_indirect(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5365
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5366
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5367
  predicate(false);
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 %{ "LBZ     $dst, $mem" %}
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_lbz(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
instruct loadUB_indirect_ac(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5376
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5377
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5378
  predicate(false);
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 %{ "LBZ     $dst, $mem\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5381
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5382
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5383
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5384
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5385
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5386
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5387
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5388
// Load Byte (8bit signed). LoadB = LoadUB + ConvUB2B.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5389
instruct loadB_indirect_Ex(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5390
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5391
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5392
  ins_cost(MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5393
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5394
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5395
    loadUB_indirect(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5396
    convB2I_reg_2(dst, tmp);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5399
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5400
instruct loadB_indirect_ac_Ex(iRegIdst dst, indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5401
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5402
  ins_cost(3*MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5403
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5404
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5405
    loadUB_indirect_ac(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5406
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5407
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5408
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5409
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5410
instruct loadUB_indOffset16(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5411
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5412
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5413
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5414
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5415
  format %{ "LBZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5416
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5417
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5418
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5419
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5420
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5421
instruct loadUB_indOffset16_ac(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5422
  // match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5423
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5424
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5425
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5426
  format %{ "LBZ     $dst, $mem\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5427
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5428
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5429
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5430
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5431
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5432
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5433
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5434
// Load Byte (8bit signed). LoadB = LoadUB + ConvUB2B.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5435
instruct loadB_indOffset16_Ex(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5436
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5437
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5438
  ins_cost(MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5439
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5440
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5441
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5442
    loadUB_indOffset16(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5443
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5444
  %}
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
instruct loadB_indOffset16_ac_Ex(iRegIdst dst, indOffset16 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5448
  match(Set dst (LoadB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5449
  ins_cost(3*MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5450
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5451
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5452
    iRegIdst tmp;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5453
    loadUB_indOffset16_ac(tmp, mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5454
    convB2I_reg_2(dst, tmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5455
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5456
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5457
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5458
// Load Unsigned Byte (8bit UNsigned) into an int reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5459
instruct loadUB(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5460
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5461
  match(Set dst (LoadUB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5462
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5463
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5464
  format %{ "LBZ     $dst, $mem \t// byte, zero-extend to int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5465
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5466
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5467
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5468
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5469
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5470
// Load  Unsigned Byte (8bit UNsigned) acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5471
instruct loadUB_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5472
  match(Set dst (LoadUB mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5473
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5474
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5475
  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
  5476
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5477
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5478
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5479
  ins_encode( enc_lbz_ac(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 Unsigned Byte (8bit UNsigned) into a Long Register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5484
instruct loadUB2L(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5485
  match(Set dst (ConvI2L (LoadUB mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5486
  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
  5487
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5488
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5489
  format %{ "LBZ     $dst, $mem \t// byte, zero-extend to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5490
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5491
  ins_encode( enc_lbz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5492
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5495
instruct loadUB2L_ac(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5496
  match(Set dst (ConvI2L (LoadUB mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5497
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5498
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5499
  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
  5500
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5501
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5502
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5503
  ins_encode( enc_lbz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5504
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5505
%}
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
// Load Short (16bit signed)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5508
instruct loadS(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5509
  match(Set dst (LoadS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5510
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5511
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5512
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5513
  format %{ "LHA     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5514
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5515
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5516
    // TODO: PPC port $archOpcode(ppc64Opcode_lha);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5517
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5518
    __ lha($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5519
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5520
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5521
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5522
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5523
// Load Short (16bit signed) acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5524
instruct loadS_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5525
  match(Set dst (LoadS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5526
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5527
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5528
  format %{ "LHA     $dst, $mem\t acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5529
            "TWI     $dst\n\t"
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
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5532
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5533
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5534
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5535
    __ lha($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5536
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5537
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5538
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5539
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5542
// Load Char (16bit unsigned)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5543
instruct loadUS(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5544
  match(Set dst (LoadUS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5545
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5546
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5547
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5548
  format %{ "LHZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5549
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5550
  ins_encode( enc_lhz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5551
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5554
// Load Char (16bit unsigned) acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5555
instruct loadUS_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5556
  match(Set dst (LoadUS mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5557
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5558
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5559
  format %{ "LHZ     $dst, $mem \t// acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5560
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5561
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5562
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5563
  ins_encode( enc_lhz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5564
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5565
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5567
// Load Unsigned Short/Char (16bit UNsigned) into a Long Register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5568
instruct loadUS2L(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5569
  match(Set dst (ConvI2L (LoadUS mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5570
  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
  5571
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5572
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5573
  format %{ "LHZ     $dst, $mem \t// short, zero-extend to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5574
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5575
  ins_encode( enc_lhz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5576
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5579
// Load Unsigned Short/Char (16bit UNsigned) into a Long Register acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5580
instruct loadUS2L_ac(iRegLdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5581
  match(Set dst (ConvI2L (LoadUS mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5582
  ins_cost(3*MEMORY_REF_COST);
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
  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
  5585
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5586
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5587
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5588
  ins_encode( enc_lhz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5589
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5590
%}
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
// Load Integer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5593
instruct loadI(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5594
  match(Set dst (LoadI mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5595
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5596
  ins_cost(MEMORY_REF_COST);
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
  format %{ "LWZ     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5599
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5600
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5601
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5602
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5603
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5604
// Load Integer acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5605
instruct loadI_ac(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5606
  match(Set dst (LoadI mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5607
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5608
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5609
  format %{ "LWZ     $dst, $mem \t// load acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5610
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5611
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5612
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5613
  ins_encode( enc_lwz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5614
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5615
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5616
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  5617
// Match loading integer and casting it to unsigned int in
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5618
// long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5619
// LoadI + ConvI2L + AndL 0xffffffff.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5620
instruct loadUI2L(iRegLdst dst, memory mem, immL_32bits mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5621
  match(Set dst (AndL (ConvI2L (LoadI mem)) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5622
  predicate(_kids[0]->_kids[0]->_leaf->as_Load()->is_unordered());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5623
  ins_cost(MEMORY_REF_COST);
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
  format %{ "LWZ     $dst, $mem \t// zero-extend to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5626
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5627
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5628
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5629
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5630
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5631
// 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
  5632
instruct loadI2L(iRegLdst dst, memoryAlg4 mem) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5633
  match(Set dst (ConvI2L (LoadI mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5634
  predicate(_kids[0]->_leaf->as_Load()->is_unordered());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5635
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5636
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5637
  format %{ "LWA     $dst, $mem \t// loadI2L" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5638
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5639
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5640
    // TODO: PPC port $archOpcode(ppc64Opcode_lwa);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5641
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5642
    __ lwa($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5643
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5644
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5645
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5646
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5647
// 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
  5648
instruct loadI2L_ac(iRegLdst dst, memoryAlg4 mem) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5649
  match(Set dst (ConvI2L (LoadI mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5650
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5651
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5652
  format %{ "LWA     $dst, $mem \t// loadI2L acquire"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5653
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5654
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5655
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5656
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5657
    // TODO: PPC port $archOpcode(ppc64Opcode_lwa);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5658
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5659
    __ lwa($dst$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5660
    __ twi_0($dst$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5661
    __ isync();
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
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5664
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5665
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5666
// Load Long - aligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5667
instruct loadL(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5668
  match(Set dst (LoadL mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5669
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5670
  ins_cost(MEMORY_REF_COST);
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
  format %{ "LD      $dst, $mem \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5673
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5674
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5675
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5676
%}
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
// Load Long - aligned acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5679
instruct loadL_ac(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5680
  match(Set dst (LoadL mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5681
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5682
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5683
  format %{ "LD      $dst, $mem \t// long acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5684
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5685
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5686
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5687
  ins_encode( enc_ld_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5688
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5689
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5690
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5691
// Load Long - UNaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5692
instruct loadL_unaligned(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5693
  match(Set dst (LoadL_unaligned mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5694
  // predicate(...) // Unaligned_ac is not needed (and wouldn't make sense).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5695
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5696
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5697
  format %{ "LD      $dst, $mem \t// unaligned long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5698
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5699
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5700
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5701
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5702
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5703
// Load nodes for superwords
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5704
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5705
// Load Aligned Packed Byte
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5706
instruct loadV8(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5707
  predicate(n->as_LoadVector()->memory_size() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5708
  match(Set dst (LoadVector mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5709
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5710
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5711
  format %{ "LD      $dst, $mem \t// load 8-byte Vector" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5712
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5713
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5714
  ins_pipe(pipe_class_memory);
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
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5717
// Load Aligned Packed Byte
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5718
instruct loadV16(vecX dst, indirect mem) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5719
  predicate(n->as_LoadVector()->memory_size() == 16);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5720
  match(Set dst (LoadVector mem));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5721
  ins_cost(MEMORY_REF_COST);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5722
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5723
  format %{ "LXVD2X      $dst, $mem \t// load 16-byte Vector" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5724
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5725
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5726
    __ lxvd2x($dst$$VectorSRegister, $mem$$Register);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5727
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5728
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5729
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  5730
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5731
// Load Range, range = array length (=jint)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5732
instruct loadRange(iRegIdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5733
  match(Set dst (LoadRange mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5734
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5735
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5736
  format %{ "LWZ     $dst, $mem \t// range" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5737
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5738
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5739
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5740
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5741
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5742
// Load Compressed Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5743
instruct loadN(iRegNdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5744
  match(Set dst (LoadN mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5745
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5746
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5747
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5748
  format %{ "LWZ     $dst, $mem \t// load compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5749
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5750
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5751
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5752
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5753
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5754
// Load Compressed Pointer acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5755
instruct loadN_ac(iRegNdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5756
  match(Set dst (LoadN mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5757
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5758
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5759
  format %{ "LWZ     $dst, $mem \t// load acquire compressed ptr\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5760
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5761
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5762
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5763
  ins_encode( enc_lwz_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5764
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5765
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5766
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5767
// Load Compressed Pointer and decode it if narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5768
instruct loadN2P_unscaled(iRegPdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5769
  match(Set dst (DecodeN (LoadN mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5770
  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
  5771
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5772
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5773
  format %{ "LWZ     $dst, $mem \t// DecodeN (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5774
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5775
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5776
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5777
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5778
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5779
instruct loadN2P_klass_unscaled(iRegPdst dst, memory mem) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5780
  match(Set dst (DecodeNKlass (LoadNKlass mem)));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5781
  predicate(Universe::narrow_klass_base() == NULL && Universe::narrow_klass_shift() == 0 &&
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5782
            _kids[0]->_leaf->as_Load()->is_unordered());
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5783
  ins_cost(MEMORY_REF_COST);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5784
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5785
  format %{ "LWZ     $dst, $mem \t// DecodeN (unscaled)" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5786
  size(4);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5787
  ins_encode( enc_lwz(dst, mem) );
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5788
  ins_pipe(pipe_class_memory);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5789
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5790
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5791
// Load Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5792
instruct loadP(iRegPdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5793
  match(Set dst (LoadP mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5794
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5795
  ins_cost(MEMORY_REF_COST);
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
  format %{ "LD      $dst, $mem \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5798
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5799
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5800
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5801
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5802
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5803
// Load Pointer acquire.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5804
instruct loadP_ac(iRegPdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5805
  match(Set dst (LoadP mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5806
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5807
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5808
  format %{ "LD      $dst, $mem \t// ptr acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5809
            "TWI     $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5810
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5811
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5812
  ins_encode( enc_ld_ac(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5813
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5816
// LoadP + CastP2L
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5817
instruct loadP2X(iRegLdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5818
  match(Set dst (CastP2X (LoadP mem)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5819
  predicate(_kids[0]->_leaf->as_Load()->is_unordered());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5820
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5821
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5822
  format %{ "LD      $dst, $mem \t// ptr + p2x" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5823
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5824
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5825
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5826
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5827
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5828
// Load compressed klass pointer.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5829
instruct loadNKlass(iRegNdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5830
  match(Set dst (LoadNKlass mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5831
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5832
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5833
  format %{ "LWZ     $dst, $mem \t// compressed klass ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5834
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5835
  ins_encode( enc_lwz(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5836
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5839
// Load Klass Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5840
instruct loadKlass(iRegPdst dst, memoryAlg4 mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5841
  match(Set dst (LoadKlass mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5842
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5843
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5844
  format %{ "LD      $dst, $mem \t// klass ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5845
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5846
  ins_encode( enc_ld(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5847
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5848
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5849
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5850
// Load Float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5851
instruct loadF(regF dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5852
  match(Set dst (LoadF mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5853
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5854
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5855
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5856
  format %{ "LFS     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5857
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5858
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5859
    // TODO: PPC port $archOpcode(ppc64Opcode_lfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5860
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5861
    __ lfs($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5862
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5863
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5864
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5865
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5866
// Load Float acquire.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5867
instruct loadF_ac(regF dst, memory mem, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5868
  match(Set dst (LoadF mem));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5869
  effect(TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5870
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5871
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5872
  format %{ "LFS     $dst, $mem \t// acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5873
            "FCMPU   cr0, $dst, $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5874
            "BNE     cr0, next\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5875
            "next:\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5876
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5877
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5878
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5879
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5880
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5881
    Label next;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5882
    __ lfs($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5883
    __ fcmpu(CCR0, $dst$$FloatRegister, $dst$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5884
    __ bne(CCR0, next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5885
    __ bind(next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5886
    __ isync();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5887
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5888
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5889
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5890
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5891
// Load Double - aligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5892
instruct loadD(regD dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5893
  match(Set dst (LoadD mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5894
  predicate(n->as_Load()->is_unordered() || followed_by_acquire(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5895
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5896
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5897
  format %{ "LFD     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5898
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5899
  ins_encode( enc_lfd(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5900
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5901
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5902
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5903
// Load Double - aligned acquire.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5904
instruct loadD_ac(regD dst, memory mem, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5905
  match(Set dst (LoadD mem));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  5906
  effect(TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5907
  ins_cost(3*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5908
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5909
  format %{ "LFD     $dst, $mem \t// acquire\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5910
            "FCMPU   cr0, $dst, $dst\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5911
            "BNE     cr0, next\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5912
            "next:\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5913
            "ISYNC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5914
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5915
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5916
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5917
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5918
    Label next;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5919
    __ lfd($dst$$FloatRegister, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5920
    __ fcmpu(CCR0, $dst$$FloatRegister, $dst$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5921
    __ bne(CCR0, next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5922
    __ bind(next);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5923
    __ isync();
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
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5926
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5927
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5928
// Load Double - UNaligned
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5929
instruct loadD_unaligned(regD dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5930
  match(Set dst (LoadD_unaligned mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5931
  // predicate(...) // Unaligned_ac is not needed (and wouldn't make sense).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5932
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5933
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5934
  format %{ "LFD     $dst, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5935
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5936
  ins_encode( enc_lfd(dst, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5937
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5938
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5939
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5940
//----------Constants--------------------------------------------------------
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
// Load MachConstantTableBase: add hi offset to global toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5943
// TODO: Handle hidden register r29 in bundler!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5944
instruct loadToc_hi(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5945
  effect(DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5946
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5947
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5948
  format %{ "ADDIS   $dst, R29, DISP.hi \t// load TOC hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5949
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5950
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5951
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5952
    __ calculate_address_from_global_toc_hi16only($dst$$Register, __ method_toc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5953
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5954
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5955
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5956
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5957
// Load MachConstantTableBase: add lo offset to global toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5958
instruct loadToc_lo(iRegLdst dst, iRegLdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5959
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5960
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5961
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5962
  format %{ "ADDI    $dst, $src, DISP.lo \t// load TOC lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5963
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5964
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5965
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5966
    __ calculate_address_from_global_toc_lo16only($dst$$Register, __ method_toc());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5967
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5968
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5969
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5970
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5971
// Load 16-bit integer constant 0xssss????
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5972
instruct loadConI16(iRegIdst dst, immI16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5973
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5974
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5975
  format %{ "LI      $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5976
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5977
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5978
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5979
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5982
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5983
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5984
// Load integer constant 0x????0000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5985
instruct loadConIhi16(iRegIdst dst, immIhi16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5986
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5987
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5988
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5989
  format %{ "LIS     $dst, $src.hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5990
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5991
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5992
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5993
    // 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
  5994
    __ lis($dst$$Register, (int)((short)(($src$$constant & 0xFFFF0000) >> 16)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5995
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5996
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  5999
// 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
  6000
// and sign extended), this adds the low 16 bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6001
instruct loadConI32_lo16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6002
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6003
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6004
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6005
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6006
  format %{ "ORI     $dst, $src1.hi, $src2.lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6007
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6008
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6009
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6010
    __ ori($dst$$Register, $src1$$Register, ($src2$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6011
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6012
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6013
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6014
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6015
instruct loadConI_Ex(iRegIdst dst, immI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6016
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6017
  ins_cost(DEFAULT_COST*2);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6020
    // Would like to use $src$$constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6021
    immI16 srcLo %{ _opnds[1]->constant() %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6022
    // srcHi can be 0000 if srcLo sign-extends to a negative number.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6023
    immIhi16 srcHi %{ _opnds[1]->constant() %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6024
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6025
    loadConIhi16(tmpI, srcHi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6026
    loadConI32_lo16(dst, tmpI, srcLo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6027
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6028
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6029
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6030
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6031
instruct loadConL16(iRegLdst dst, immL16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6032
  match(Set dst src);
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
  format %{ "LI      $dst, $src \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6035
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6036
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6037
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6038
    __ li($dst$$Register, (int)((short) ($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6039
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6040
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6041
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6042
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6043
// Load long constant 0xssssssss????0000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6044
instruct loadConL32hi16(iRegLdst dst, immL32hi16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6045
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6046
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6047
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6048
  format %{ "LIS     $dst, $src.hi \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6049
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6050
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6051
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6052
    __ lis($dst$$Register, (int)((short)(($src$$constant & 0xFFFF0000) >> 16)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6053
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6054
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6055
%}
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
// 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
  6058
// high 16 bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6059
instruct loadConL32_lo16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6060
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6061
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6062
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6063
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6064
  format %{ "ORI     $dst, $src1, $src2.lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6065
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6066
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6067
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6068
    __ ori($dst$$Register, $src1$$Register, ($src2$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6069
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6070
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6071
%}
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
// Load 32-bit long constant
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6074
instruct loadConL32_Ex(iRegLdst dst, immL32 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6075
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6076
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6077
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6078
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6079
    // Would like to use $src$$constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6080
    immL16     srcLo %{ _opnds[1]->constant() /*& 0x0000FFFFL */%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6081
    // srcHi can be 0000 if srcLo sign-extends to a negative number.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6082
    immL32hi16 srcHi %{ _opnds[1]->constant() /*& 0xFFFF0000L */%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6083
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6084
    loadConL32hi16(tmpL, srcHi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6085
    loadConL32_lo16(dst, tmpL, srcLo);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6086
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6087
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6088
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6089
// Load long constant 0x????000000000000.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6090
instruct loadConLhighest16_Ex(iRegLdst dst, immLhighest16 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6091
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6092
  ins_cost(DEFAULT_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6095
    immL32hi16 srcHi %{ _opnds[1]->constant() >> 32 /*& 0xFFFF0000L */%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6096
    immI shift32 %{ 32 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6097
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6098
    loadConL32hi16(tmpL, srcHi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6099
    lshiftL_regL_immI(dst, tmpL, shift32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6100
  %}
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 loadConL(iRegLdst dst, immL 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
  // Needed so that CallDynamicJavaDirect can compute the address of this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6110
  // instruction for relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6111
  ins_field_cbuf_insts_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6112
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6113
  format %{ "LD      $dst, offset, $toc \t// load long $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6114
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6115
  ins_encode( enc_load_long_constL(dst, src, toc) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6116
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6117
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6118
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6119
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6120
instruct loadConL_hi(iRegLdst dst, immL src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6121
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6122
  predicate(false);
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
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6125
  ins_field_const_toc_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6126
  // Needed so that CallDynamicJavaDirect can compute the address of this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6127
  // instruction for relocation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6128
  ins_field_cbuf_insts_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6129
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6130
  format %{ "ADDIS   $dst, $toc, offset \t// load long $src from TOC (hi)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6131
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6132
  ins_encode( enc_load_long_constL_hi(dst, toc, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6133
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6134
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6135
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6136
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6137
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6138
instruct loadConL_lo(iRegLdst dst, immL src, iRegLdst base) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6139
  effect(DEF dst, USE src, USE base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6140
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6141
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6142
  ins_field_const_toc_offset_hi_node(loadConL_hiNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6143
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6144
  format %{ "LD      $dst, offset, $base \t// load long $src from TOC (lo)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6145
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6146
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6147
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6148
    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
  6149
    __ ld($dst$$Register, MacroAssembler::largeoffset_si16_si16_lo(offset), $base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6150
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6151
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6152
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6153
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6154
// Load long constant from constant table. Expand in case of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6155
// offset > 16 bit is needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6156
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6157
instruct loadConL_Ex(iRegLdst dst, immL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6158
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6159
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6160
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6161
  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
  6162
  // 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
  6163
  postalloc_expand( postalloc_expand_load_long_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6164
%}
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
// Load NULL as compressed oop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6167
instruct loadConN0(iRegNdst dst, immN_0 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6168
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6169
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6170
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6171
  format %{ "LI      $dst, $src \t// compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6172
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6173
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6174
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6175
    __ li($dst$$Register, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6176
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6177
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6178
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6179
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6180
// Load hi part of compressed oop constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6181
instruct loadConN_hi(iRegNdst dst, immN src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6182
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6183
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6184
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6185
  format %{ "LIS     $dst, $src \t// narrow oop hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6186
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6187
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6188
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6189
    __ lis($dst$$Register, (int)(short)(($src$$constant >> 16) & 0xffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6190
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6191
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6192
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6193
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6194
// Add lo part of compressed oop constant to already loaded hi part.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6195
instruct loadConN_lo(iRegNdst dst, iRegNsrc src1, immN src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6196
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6197
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6198
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6199
  format %{ "ORI     $dst, $src1, $src2 \t// narrow oop lo" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6200
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6201
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6202
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6203
    assert(__ oop_recorder() != NULL, "this assembler needs an OopRecorder");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6204
    int oop_index = __ oop_recorder()->find_index((jobject)$src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6205
    RelocationHolder rspec = oop_Relocation::spec(oop_index);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6206
    __ relocate(rspec, 1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6207
    __ ori($dst$$Register, $src1$$Register, $src2$$constant & 0xffff);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6208
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6209
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6210
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6211
46521
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  6212
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
  6213
  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
  6214
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  6215
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  6216
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  6217
    __ 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
  6218
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  6219
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  6220
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
  6221
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6222
// Needed to postalloc expand loadConN: ConN is loaded as ConI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6223
// leaving the upper 32 bits with sign-extension bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6224
// This clears these bits: dst = src & 0xFFFFFFFF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6225
// TODO: Eventually call this maskN_regN_FFFFFFFF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6226
instruct clearMs32b(iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6227
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6228
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6229
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6230
  format %{ "MASK    $dst, $src, 0xFFFFFFFF" %} // mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6231
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6232
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6233
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6234
    __ clrldi($dst$$Register, $src$$Register, 0x20);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6235
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6236
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6237
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6238
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6239
// Optimize DecodeN for disjoint base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6240
// Load base of compressed oops into a register
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6241
instruct loadBase(iRegLdst dst) %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6242
  effect(DEF dst);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6243
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6244
  format %{ "LoadConst $dst, heapbase" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6245
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6246
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6247
    __ 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
  6248
  %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6249
  ins_pipe(pipe_class_default);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6250
%}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6251
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6252
// Loading ConN must be postalloc expanded so that edges between
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6253
// the nodes are safe. They may not interfere with a safepoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6254
// 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
  6255
instruct loadConN_Ex(iRegNdst dst, immN src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6256
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6257
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6258
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6259
  format %{ "LoadN   $dst, $src \t// postalloc expanded" %} // mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6260
  postalloc_expand %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6261
    MachNode *m1 = new loadConN_hiNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6262
    MachNode *m2 = new loadConN_loNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6263
    MachNode *m3 = new clearMs32bNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6264
    m1->add_req(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6265
    m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6266
    m3->add_req(NULL, m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6267
    m1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6268
    m1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6269
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6270
    m2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6271
    m2->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6272
    m3->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6273
    m3->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6274
    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
  6275
    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
  6276
    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
  6277
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6278
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6279
    nodes->push(m3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6280
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6281
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6282
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6283
// 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
  6284
// 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
  6285
// not a narrow oop.
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6286
instruct loadConNKlass_hi(iRegNdst dst, immNKlass_NM src) %{
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6287
  match(Set dst src);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6288
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6289
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6290
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6291
  format %{ "LIS     $dst, $src \t// narrow klass hi" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6292
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6293
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6294
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6295
    intptr_t Csrc = Klass::encode_klass((Klass *)$src$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6296
    __ lis($dst$$Register, (int)(short)((Csrc >> 16) & 0xffff));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6297
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6298
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6299
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6300
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6301
// As loadConNKlass_hi this must be recognized as narrow klass, not oop!
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6302
instruct loadConNKlass_mask(iRegNdst dst, immNKlass_NM src1, iRegNsrc src2) %{
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6303
  match(Set dst src1);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6304
  effect(TEMP src2);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6305
  ins_cost(DEFAULT_COST);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6306
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6307
  format %{ "MASK    $dst, $src2, 0xFFFFFFFF" %} // mask
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6308
  size(4);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6309
  ins_encode %{
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6310
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6311
    __ clrldi($dst$$Register, $src2$$Register, 0x20);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6312
  %}
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6313
  ins_pipe(pipe_class_default);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6314
%}
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6315
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  6316
// 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
  6317
// not a narrow oop.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6318
instruct loadConNKlass_lo(iRegNdst dst, immNKlass_NM src1, iRegNsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6319
  match(Set dst src1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6320
  effect(TEMP src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6321
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6322
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6323
  format %{ "ORI     $dst, $src1, $src2 \t// narrow klass lo" %}
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6324
  size(4);
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6325
  ins_encode %{
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6326
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6327
    intptr_t Csrc = Klass::encode_klass((Klass *)$src1$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6328
    assert(__ oop_recorder() != NULL, "this assembler needs an OopRecorder");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6329
    int klass_index = __ oop_recorder()->find_index((Klass *)$src1$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6330
    RelocationHolder rspec = metadata_Relocation::spec(klass_index);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6331
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6332
    __ relocate(rspec, 1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6333
    __ ori($dst$$Register, $src2$$Register, Csrc & 0xffff);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6336
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6337
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6338
// Loading ConNKlass must be postalloc expanded so that edges between
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6339
// the nodes are safe. They may not interfere with a safepoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6340
instruct loadConNKlass_Ex(iRegNdst dst, immNKlass src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6341
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6342
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6343
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6344
  format %{ "LoadN   $dst, $src \t// postalloc expanded" %} // mask
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6345
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6346
    // Load high bits into register. Sign extended.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6347
    MachNode *m1 = new loadConNKlass_hiNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6348
    m1->add_req(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6349
    m1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6350
    m1->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6351
    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
  6352
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6353
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6354
    MachNode *m2 = m1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6355
    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
  6356
      // Value might be 1-extended. Mask out these bits.
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6357
      m2 = new loadConNKlass_maskNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6358
      m2->add_req(NULL, m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6359
      m2->_opnds[0] = op_dst;
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6360
      m2->_opnds[1] = op_src;
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  6361
      m2->_opnds[2] = op_dst;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6362
      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
  6363
      nodes->push(m2);
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
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  6366
    MachNode *m3 = new loadConNKlass_loNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6367
    m3->add_req(NULL, m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6368
    m3->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6369
    m3->_opnds[1] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6370
    m3->_opnds[2] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6371
    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
  6372
    nodes->push(m3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6373
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6374
%}
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
// 0x1 is used in object initialization (initial object header).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6377
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6378
instruct loadConP0or1(iRegPdst dst, immP_0or1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6379
  match(Set dst src);
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
  format %{ "LI      $dst, $src \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6382
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6383
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6384
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6385
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6388
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6389
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6390
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6391
// The match rule is needed to generate the correct bottom_type(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6392
// however this node should never match. The use of predicate is not
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6393
// possible since ADLC forbids predicates for chain rules. The higher
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6394
// costs do not prevent matching in this case. For that reason the
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6395
// operand immP_NM with predicate(false) is used.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6396
instruct loadConP(iRegPdst dst, immP_NM src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6397
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6398
  effect(TEMP toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6399
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6400
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6401
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6402
  format %{ "LD      $dst, offset, $toc \t// load ptr $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6403
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6404
  ins_encode( enc_load_long_constP(dst, src, toc) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6405
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6406
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6407
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6408
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6409
instruct loadConP_hi(iRegPdst dst, immP_NM src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6410
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6411
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6412
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6413
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6414
  ins_field_const_toc_offset(int);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6415
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6416
  format %{ "ADDIS   $dst, $toc, offset \t// load ptr $src from TOC (hi)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6417
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6418
  ins_encode( enc_load_long_constP_hi(dst, src, toc) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6419
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6420
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6421
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6422
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6423
instruct loadConP_lo(iRegPdst dst, immP_NM src, iRegLdst base) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6424
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6425
  effect(TEMP base);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6426
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6427
  ins_field_const_toc_offset_hi_node(loadConP_hiNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6428
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6429
  format %{ "LD      $dst, offset, $base \t// load ptr $src from TOC (lo)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6430
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6431
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6432
    // TODO: PPC port $archOpcode(ppc64Opcode_ld);
22865
3b8857d7b3cc 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 22861
diff changeset
  6433
    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
  6434
    __ ld($dst$$Register, MacroAssembler::largeoffset_si16_si16_lo(offset), $base$$Register);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6435
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6436
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6437
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6438
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6439
// Load pointer constant from constant table. Expand in case an
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6440
// offset > 16 bit is needed.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6441
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6442
instruct loadConP_Ex(iRegPdst dst, immP src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6443
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6444
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6445
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6446
  // This rule does not use "expand" because then
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6447
  // the result type is not known to be an Oop.  An ADLC
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6448
  // enhancement will be needed to make that work - not worth it!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6449
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6450
  // If this instruction rematerializes, it prolongs the live range
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6451
  // of the toc node, causing illegal graphs.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6452
  // 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
  6453
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6454
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6455
  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
  6456
  postalloc_expand( postalloc_expand_load_ptr_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6457
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6458
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6459
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6460
instruct loadConF(regF dst, immF src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6461
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6462
  ins_cost(MEMORY_REF_COST);
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
  ins_num_consts(1);
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
  format %{ "LFS     $dst, offset, $toc \t// load float $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6467
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6468
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6469
    // TODO: PPC port $archOpcode(ppc64Opcode_lfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6470
    address float_address = __ float_constant($src$$constant);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6471
    if (float_address == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6472
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6473
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6474
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6475
    __ lfs($dst$$FloatRegister, __ offset_to_method_toc(float_address), $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6476
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6477
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6478
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6479
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6480
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6481
instruct loadConFComp(regF dst, immF src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6482
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6483
  ins_cost(MEMORY_REF_COST);
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
  ins_num_consts(1);
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
  format %{ "ADDIS   $toc, $toc, offset_hi\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6488
            "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
  6489
            "ADDIS   $toc, $toc, -offset_hi"%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6490
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6491
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6492
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6493
    FloatRegister Rdst    = $dst$$FloatRegister;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6494
    Register Rtoc         = $toc$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6495
    address float_address = __ float_constant($src$$constant);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6496
    if (float_address == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6497
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6498
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6499
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6500
    int offset            = __ offset_to_method_toc(float_address);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6501
    int hi = (offset + (1<<15))>>16;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6502
    int lo = offset - hi * (1<<16);
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
    __ addis(Rtoc, Rtoc, hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6505
    __ lfs(Rdst, lo, Rtoc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6506
    __ addis(Rtoc, Rtoc, -hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6507
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6508
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6511
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6512
instruct loadConF_Ex(regF dst, immF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6513
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6514
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6515
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6516
  // See loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6517
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6518
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6519
  format %{ "LFS     $dst, offset, $constanttablebase \t// load $src from table, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6520
  postalloc_expand( postalloc_expand_load_float_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6521
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6522
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6523
// Expand node for constant pool load: small offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6524
instruct loadConD(regD dst, immD src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6525
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6526
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6527
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6528
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6529
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6530
  format %{ "LFD     $dst, offset, $toc \t// load double $src from TOC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6531
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6532
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6533
    // TODO: PPC port $archOpcode(ppc64Opcode_lfd);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6534
    address float_address = __ double_constant($src$$constant);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6535
    if (float_address == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6536
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6537
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6538
    }
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6539
    int offset =  __ offset_to_method_toc(float_address);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6540
    __ lfd($dst$$FloatRegister, offset, $toc$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6541
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6542
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6543
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6544
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6545
// Expand node for constant pool load: large offset.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6546
instruct loadConDComp(regD dst, immD src, iRegLdst toc) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6547
  effect(DEF dst, USE src, USE toc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6548
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6549
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6550
  ins_num_consts(1);
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
  format %{ "ADDIS   $toc, $toc, offset_hi\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6553
            "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
  6554
            "ADDIS   $toc, $toc, -offset_hi" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6555
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6556
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6557
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6558
    FloatRegister Rdst    = $dst$$FloatRegister;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6559
    Register      Rtoc    = $toc$$Register;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6560
    address float_address = __ double_constant($src$$constant);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6561
    if (float_address == NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6562
      ciEnv::current()->record_out_of_memory_failure();
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6563
      return;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6564
    }
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 34185
diff changeset
  6565
    int offset = __ offset_to_method_toc(float_address);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6566
    int hi = (offset + (1<<15))>>16;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6567
    int lo = offset - hi * (1<<16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6568
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6569
    __ addis(Rtoc, Rtoc, hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6570
    __ lfd(Rdst, lo, Rtoc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6571
    __ addis(Rtoc, Rtoc, -hi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6572
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6573
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6576
// Adlc adds toc node MachConstantTableBase.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6577
instruct loadConD_Ex(regD dst, immD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6578
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6579
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6580
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6581
  // See loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6582
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6583
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6584
  format %{ "ConD    $dst, offset, $constanttablebase \t// load $src from table, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6585
  postalloc_expand( postalloc_expand_load_double_constant(dst, src, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6586
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6587
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6588
// Prefetch instructions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6589
// Must be safe to execute with invalid address (cannot fault).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6590
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6591
// Special prefetch versions which use the dcbz instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6592
instruct prefetch_alloc_zero(indirectMemory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6593
  match(PrefetchAllocation (AddP mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6594
  predicate(AllocatePrefetchStyle == 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6595
  ins_cost(MEMORY_REF_COST);
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 %{ "PREFETCH $mem, 2, $src \t// Prefetch write-many with zero" %}
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_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6601
    __ dcbz($src$$Register, $mem$$base$$Register);
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_memory);
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
instruct prefetch_alloc_zero_no_offset(indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6607
  match(PrefetchAllocation mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6608
  predicate(AllocatePrefetchStyle == 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6609
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6610
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6611
  format %{ "PREFETCH $mem, 2 \t// Prefetch write-many with zero" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6612
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6613
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6614
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6615
    __ dcbz($mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6616
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6617
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6618
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6619
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6620
instruct prefetch_alloc(indirectMemory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6621
  match(PrefetchAllocation (AddP mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6622
  predicate(AllocatePrefetchStyle != 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6623
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6624
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6625
  format %{ "PREFETCH $mem, 2, $src \t// Prefetch write-many" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6626
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6627
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6628
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6629
    __ dcbtst($src$$Register, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6630
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6631
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6632
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6633
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6634
instruct prefetch_alloc_no_offset(indirectMemory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6635
  match(PrefetchAllocation mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6636
  predicate(AllocatePrefetchStyle != 3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6637
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6638
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6639
  format %{ "PREFETCH $mem, 2 \t// Prefetch write-many" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6640
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6641
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6642
    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6643
    __ dcbtst($mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6644
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6645
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6646
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6647
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6648
//----------Store Instructions-------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6649
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6650
// Store Byte
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6651
instruct storeB(memory mem, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6652
  match(Set mem (StoreB mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6653
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6654
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6655
  format %{ "STB     $src, $mem \t// byte" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6656
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6657
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6658
    // TODO: PPC port $archOpcode(ppc64Opcode_stb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6659
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6660
    __ stb($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6661
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6662
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6663
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6664
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6665
// Store Char/Short
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6666
instruct storeC(memory mem, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6667
  match(Set mem (StoreC mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6668
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6669
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6670
  format %{ "STH     $src, $mem \t// short" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6671
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6672
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6673
    // TODO: PPC port $archOpcode(ppc64Opcode_sth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6674
    int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6675
    __ sth($src$$Register, Idisp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6676
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6677
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6678
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6679
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6680
// Store Integer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6681
instruct storeI(memory mem, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6682
  match(Set mem (StoreI mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6683
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6684
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6685
  format %{ "STW     $src, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6686
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6687
  ins_encode( enc_stw(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6688
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6689
%}
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
// ConvL2I + StoreI.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6692
instruct storeI_convL2I(memory mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6693
  match(Set mem (StoreI mem (ConvL2I src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6694
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6695
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6696
  format %{ "STW     l2i($src), $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6697
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6698
  ins_encode( enc_stw(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6699
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6700
%}
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
// Store Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6703
instruct storeL(memoryAlg4 mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6704
  match(Set mem (StoreL mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6705
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6706
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6707
  format %{ "STD     $src, $mem \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6708
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6709
  ins_encode( enc_std(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6710
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6713
// Store super word nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6714
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6715
// Store Aligned Packed Byte long register to memory
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6716
instruct storeA8B(memoryAlg4 mem, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6717
  predicate(n->as_StoreVector()->memory_size() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6718
  match(Set mem (StoreVector mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6719
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6720
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6721
  format %{ "STD     $mem, $src \t// packed8B" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6722
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6723
  ins_encode( enc_std(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6724
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6725
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6726
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6727
// Store Packed Byte long register to memory
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6728
instruct storeV16(indirect mem, vecX src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6729
  predicate(n->as_StoreVector()->memory_size() == 16);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6730
  match(Set mem (StoreVector mem src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6731
  ins_cost(MEMORY_REF_COST);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6732
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6733
  format %{ "STXVD2X     $mem, $src \t// store 16-byte Vector" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6734
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6735
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6736
    __ stxvd2x($src$$VectorSRegister, $mem$$Register);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6737
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6738
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6739
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
  6740
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6741
// Store Compressed Oop
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6742
instruct storeN(memory dst, iRegN_P2N src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6743
  match(Set dst (StoreN dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6744
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6745
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6746
  format %{ "STW     $src, $dst \t// compressed oop" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6747
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6748
  ins_encode( enc_stw(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6749
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6750
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6751
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6752
// Store Compressed KLass
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6753
instruct storeNKlass(memory dst, iRegN_P2N src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6754
  match(Set dst (StoreNKlass dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6755
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6756
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6757
  format %{ "STW     $src, $dst \t// compressed klass" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6758
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6759
  ins_encode( enc_stw(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6760
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6761
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6762
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6763
// Store Pointer
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6764
instruct storeP(memoryAlg4 dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6765
  match(Set dst (StoreP dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6766
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6767
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6768
  format %{ "STD     $src, $dst \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6769
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6770
  ins_encode( enc_std(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6771
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6772
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6773
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6774
// Store Float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6775
instruct storeF(memory mem, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6776
  match(Set mem (StoreF mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6777
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6778
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6779
  format %{ "STFS    $src, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6780
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6781
  ins_encode( enc_stfs(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6782
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6783
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6784
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6785
// Store Double
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6786
instruct storeD(memory mem, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6787
  match(Set mem (StoreD mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6788
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6789
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6790
  format %{ "STFD    $src, $mem" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6791
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6792
  ins_encode( enc_stfd(src, mem) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6793
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6794
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6795
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6796
//----------Store Instructions With Zeros--------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6797
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6798
// Card-mark for CMS garbage collection.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6799
// This cardmark does an optimization so that it must not always
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6800
// do a releasing store. For this, it gets the address of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6801
// CMSCollectorCardTableModRefBSExt::_requires_release as input.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6802
// (Using releaseFieldAddr in the match rule is a hack.)
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6803
instruct storeCM_CMS(memory mem, iRegLdst releaseFieldAddr, flagsReg crx) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6804
  match(Set mem (StoreCM mem releaseFieldAddr));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6805
  effect(TEMP crx);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6806
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6807
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6808
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6809
  // See loadConP.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6810
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6811
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6812
  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
  6813
  ins_encode( enc_cms_card_mark(mem, releaseFieldAddr, crx) );
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6814
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6815
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6816
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6817
// Card-mark for CMS garbage collection.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6818
// This cardmark does an optimization so that it must not always
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6819
// do a releasing store. For this, it needs the constant address of
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6820
// CMSCollectorCardTableModRefBSExt::_requires_release.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6821
// 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
  6822
// adlc / matcher functionality to load it from the constant section.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6823
instruct storeCM_CMS_ExEx(memory mem, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6824
  match(Set mem (StoreCM mem zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6825
  predicate(UseConcMarkSweepGC);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6826
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6827
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6828
    immL baseImm %{ 0 /* TODO: PPC port (jlong)CMSCollectorCardTableModRefBSExt::requires_release_address() */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6829
    iRegLdst releaseFieldAddress;
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6830
    flagsReg crx;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6831
    loadConL_Ex(releaseFieldAddress, baseImm);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6832
    storeCM_CMS(mem, releaseFieldAddress, crx);
22861
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6835
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6836
instruct storeCM_G1(memory mem, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6837
  match(Set mem (StoreCM mem zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6838
  predicate(UseG1GC);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6839
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6840
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6841
  ins_cannot_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6842
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6843
  format %{ "STB     #0, $mem \t// CMS card-mark byte store (G1)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6844
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6845
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6846
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6847
    __ li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6848
    //__ release(); // G1: oops are allowed to get visible after dirty marking
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6849
    guarantee($mem$$base$$Register != R1_SP, "use frame_slots_bias");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6850
    __ stb(R0, $mem$$disp, $mem$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6851
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6852
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6853
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6854
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6855
// Convert oop pointer into compressed form.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6856
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6857
// Nodes for postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6858
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6859
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6860
instruct encodeP_shift(iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6861
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6862
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6863
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6864
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6865
  format %{ "SRDI    $dst, $src, 3 \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6866
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6867
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6868
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6869
    __ srdi($dst$$Register, $src$$Register, Universe::narrow_oop_shift() & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6870
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6871
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6872
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6873
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6874
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6875
instruct encodeP_sub(iRegPdst dst, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6876
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6877
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6878
  predicate(false);
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
  format %{ "SUB     $dst, $src, oop_base \t// encode" %}
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6881
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6882
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6883
    __ 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
  6884
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6885
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6886
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6887
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6888
// Conditional sub base.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6889
instruct cond_sub_base(iRegNdst dst, flagsRegSrc crx, iRegPsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6890
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6891
  match(Set dst (EncodeP (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6892
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6893
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6894
  format %{ "BEQ     $crx, done\n\t"
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6895
            "SUB     $dst, $src1, heapbase \t// encode: subtract base if != NULL\n"
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6896
            "done:" %}
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6897
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6898
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6899
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6900
    __ beq($crx$$CondRegister, done);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6901
    __ 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
  6902
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6903
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6904
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6905
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6906
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6907
// Power 7 can use isel instruction
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  6908
instruct cond_set_0_oop(iRegNdst dst, flagsRegSrc crx, iRegPsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6909
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6910
  match(Set dst (EncodeP (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6911
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6912
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6913
  format %{ "CMOVE   $dst, $crx eq, 0, $src1 \t// encode: preserve 0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6914
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6915
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6916
    // 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
  6917
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6918
    __ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6919
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6920
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6921
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6922
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6923
// Disjoint narrow oop base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6924
instruct encodeP_Disjoint(iRegNdst dst, iRegPsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6925
  match(Set dst (EncodeP src));
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6926
  predicate(Universe::narrow_oop_base_disjoint());
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6927
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6928
  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with disjoint base" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6929
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6930
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6931
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6932
    __ rldicl($dst$$Register, $src$$Register, 64-Universe::narrow_oop_shift(), 32);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6935
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6936
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6937
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6938
instruct encodeP_Ex(iRegNdst dst, flagsReg crx, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6939
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6940
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6941
  predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6942
            Universe::narrow_oop_shift() != 0 &&
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6943
            Universe::narrow_oop_base_overlaps());
22861
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 %{ "EncodeP $dst, $crx, $src \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6946
  postalloc_expand( postalloc_expand_encode_oop(dst, src, crx));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6947
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6948
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6949
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6950
instruct encodeP_not_null_Ex(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6951
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6952
  predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6953
            Universe::narrow_oop_shift() != 0 &&
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  6954
            Universe::narrow_oop_base_overlaps());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6955
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6956
  format %{ "EncodeP $dst, $src\t// $src != Null, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6957
  postalloc_expand( postalloc_expand_encode_oop_not_null(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6958
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6959
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6960
// shift != 0, base == 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6961
// TODO: This is the same as encodeP_shift. Merge!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6962
instruct encodeP_not_null_base_null(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6963
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6964
  predicate(Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6965
            Universe::narrow_oop_base() ==0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6966
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6967
  format %{ "SRDI    $dst, $src, #3 \t// encodeP, $src != NULL" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6968
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6969
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6970
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6971
    __ srdi($dst$$Register, $src$$Register, Universe::narrow_oop_shift() & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6972
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6973
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6974
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6975
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6976
// Compressed OOPs with narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6977
// shift == 0, base == 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6978
instruct encodeP_narrow_oop_shift_0(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6979
  match(Set dst (EncodeP src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6980
  predicate(Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6981
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6982
  format %{ "MR      $dst, $src \t// Ptr->Narrow" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6983
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6984
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6985
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6986
    __ mr_if_needed($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6989
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6990
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6991
// Decode nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6992
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6993
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6994
instruct decodeN_shift(iRegPdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6995
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6996
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6997
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6998
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  6999
  format %{ "SLDI    $dst, $src, #3 \t// DecodeN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7000
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7001
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7002
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7003
    __ sldi($dst$$Register, $src$$Register, Universe::narrow_oop_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7004
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7005
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7006
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7007
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7008
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7009
instruct decodeN_add(iRegPdst dst, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7010
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7011
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7012
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7013
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7014
  format %{ "ADD     $dst, $src, heapbase \t// DecodeN, add oop base" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7015
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7016
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7017
    __ 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
  7018
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7019
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7020
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7021
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7022
// conditianal add base for expand
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7023
instruct cond_add_base(iRegPdst dst, flagsRegSrc crx, iRegPsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7024
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7025
  // 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
  7026
  //  - _matrule->_rChild->_opType == "DecodeN" (see InstructForm::captures_bottom_type() in formssel.cpp)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7027
  //  - 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
  7028
  match(Set dst (DecodeN (Binary crx src)));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7029
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7030
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7031
  format %{ "BEQ     $crx, done\n\t"
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7032
            "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
  7033
            "done:" %}
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7034
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7035
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7036
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7037
    __ beq($crx$$CondRegister, done);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7038
    __ 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
  7039
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7040
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7041
  ins_pipe(pipe_class_default);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7044
instruct cond_set_0_ptr(iRegPdst dst, flagsRegSrc crx, iRegPsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7045
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7046
  // 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
  7047
  //  - _matrule->_rChild->_opType == "DecodeN" (see InstructForm::captures_bottom_type() in formssel.cpp)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7048
  //  - 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
  7049
  match(Set dst (DecodeN (Binary crx src1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7050
  predicate(false);
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
  format %{ "CMOVE   $dst, $crx eq, 0, $src1 \t// decode: preserve 0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7053
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7054
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7055
    // 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
  7056
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7057
    __ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7058
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7059
  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
//  shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7063
instruct decodeN_Ex(iRegPdst dst, iRegNsrc src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7064
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7065
  predicate((n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7066
             n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7067
            Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7068
            Universe::narrow_oop_base() != 0);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7069
  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
  7070
  effect(TEMP crx);
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
  format %{ "DecodeN $dst, $src \t// Kills $crx, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7073
  postalloc_expand( postalloc_expand_decode_oop(dst, src, crx) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7074
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7075
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7076
// shift != 0, base == 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7077
instruct decodeN_nullBase(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7078
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7079
  predicate(Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7080
            Universe::narrow_oop_base() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7081
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7082
  format %{ "SLDI    $dst, $src, #3 \t// DecodeN (zerobased)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7083
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7084
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7085
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7086
    __ sldi($dst$$Register, $src$$Register, Universe::narrow_oop_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7087
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7088
  ins_pipe(pipe_class_default);
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
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7091
// Optimize DecodeN for disjoint base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7092
// 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
  7093
// 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
  7094
instruct decodeN_mergeDisjoint(iRegPdst dst, iRegNsrc src, iRegLsrc base) %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7095
  match(Set dst (DecodeN src));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7096
  effect(TEMP base);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7097
  predicate(false);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7098
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7099
  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
  7100
  size(4);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7101
  ins_encode %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7102
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7103
    __ 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
  7104
  %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7105
  ins_pipe(pipe_class_default);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7106
%}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7107
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7108
// Optimize DecodeN for disjoint base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7109
// 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
  7110
// 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
  7111
// 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
  7112
instruct decodeN_Disjoint_notNull_Ex(iRegPdst dst, iRegNsrc src) %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7113
  match(Set dst (DecodeN src));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7114
  effect(TEMP_DEF dst);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7115
  predicate((n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7116
             n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant) &&
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7117
            Universe::narrow_oop_base_disjoint());
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7118
  ins_cost(DEFAULT_COST);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7119
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7120
  format %{ "MOV     $dst, heapbase \t\n"
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7121
            "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
  7122
  postalloc_expand %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7123
    loadBaseNode *n1 = new loadBaseNode();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7124
    n1->add_req(NULL);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7125
    n1->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7126
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7127
    decodeN_mergeDisjointNode *n2 = new decodeN_mergeDisjointNode();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7128
    n2->add_req(n_region, n_src, n1);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7129
    n2->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7130
    n2->_opnds[1] = op_src;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7131
    n2->_opnds[2] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7132
    n2->_bottom_type = _bottom_type;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7133
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7134
    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
  7135
    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
  7136
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7137
    nodes->push(n1);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7138
    nodes->push(n2);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7139
  %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7140
%}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7141
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7142
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
  7143
  match(Set dst (DecodeN src));
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7144
  effect(TEMP_DEF dst, TEMP crx);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7145
  predicate((n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull &&
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7146
             n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant) &&
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7147
            Universe::narrow_oop_base_disjoint() && VM_Version::has_isel());
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7148
  ins_cost(3 * DEFAULT_COST);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7149
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7150
  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
  7151
  postalloc_expand %{
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7152
    loadBaseNode *n1 = new loadBaseNode();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7153
    n1->add_req(NULL);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7154
    n1->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7155
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7156
    cmpN_reg_imm0Node *n_compare  = new cmpN_reg_imm0Node();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7157
    n_compare->add_req(n_region, n_src);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7158
    n_compare->_opnds[0] = op_crx;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7159
    n_compare->_opnds[1] = op_src;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7160
    n_compare->_opnds[2] = new immN_0Oper(TypeNarrowOop::NULL_PTR);
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
  7161
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7162
    decodeN_mergeDisjointNode *n2 = new decodeN_mergeDisjointNode();
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7163
    n2->add_req(n_region, n_src, n1);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7164
    n2->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7165
    n2->_opnds[1] = op_src;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7166
    n2->_opnds[2] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7167
    n2->_bottom_type = _bottom_type;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7168
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7169
    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
  7170
    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
  7171
    n_cond_set->_opnds[0] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7172
    n_cond_set->_opnds[1] = op_crx;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7173
    n_cond_set->_opnds[2] = op_dst;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7174
    n_cond_set->_bottom_type = _bottom_type;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7175
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7176
    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
  7177
    ra_->set_oop(n_cond_set, true);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7178
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7179
    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
  7180
    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
  7181
    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
  7182
    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
  7183
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7184
    nodes->push(n1);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7185
    nodes->push(n_compare);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7186
    nodes->push(n2);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7187
    nodes->push(n_cond_set);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7188
  %}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7189
%}
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7190
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7191
// src != 0, shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7192
instruct decodeN_notNull_addBase_Ex(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7193
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7194
  predicate((n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7195
             n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7196
            Universe::narrow_oop_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7197
            Universe::narrow_oop_base() != 0);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7198
  ins_cost(2 * DEFAULT_COST);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7199
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7200
  format %{ "DecodeN $dst, $src \t// $src != NULL, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7201
  postalloc_expand( postalloc_expand_decode_oop_not_null(dst, src));
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7204
// Compressed OOPs with narrow_oop_shift == 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7205
instruct decodeN_unscaled(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7206
  match(Set dst (DecodeN src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7207
  predicate(Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7208
  ins_cost(DEFAULT_COST);
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
  format %{ "MR      $dst, $src \t// DecodeN (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7211
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7212
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7213
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7214
    __ mr_if_needed($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7217
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7218
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7219
// Convert compressed oop into int for vectors alignment masking.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7220
instruct decodeN2I_unscaled(iRegIdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7221
  match(Set dst (ConvL2I (CastP2X (DecodeN src))));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7222
  predicate(Universe::narrow_oop_shift() == 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7223
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7224
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7225
  format %{ "MR      $dst, $src \t// (int)DecodeN (unscaled)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7226
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7227
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7228
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7229
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7230
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7231
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7232
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7233
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7234
// Convert klass pointer into compressed form.
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
// Nodes for postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7237
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7238
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7239
instruct encodePKlass_shift(iRegNdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7240
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7241
  match(Set dst (EncodePKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7242
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7243
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7244
  format %{ "SRDI    $dst, $src, 3 \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7245
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7246
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7247
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7248
    __ srdi($dst$$Register, $src$$Register, Universe::narrow_klass_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7249
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7250
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7251
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7252
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7253
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7254
instruct encodePKlass_sub_base(iRegPdst dst, iRegLsrc base, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7255
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7256
  match(Set dst (EncodePKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7257
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7258
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7259
  format %{ "SUB     $dst, $base, $src \t// encode" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7260
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7261
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7262
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7263
    __ subf($dst$$Register, $base$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7264
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7265
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7266
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7267
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7268
// Disjoint narrow oop base.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7269
instruct encodePKlass_Disjoint(iRegNdst dst, iRegPsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7270
  match(Set dst (EncodePKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7271
  predicate(false /* TODO: PPC port Universe::narrow_klass_base_disjoint()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7272
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
  7273
  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with disjoint base" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7274
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7275
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7276
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
27012
f8fdfab4757b 8059592: Recent bugfixes in ppc64 port.
goetz
parents: 25930
diff changeset
  7277
    __ rldicl($dst$$Register, $src$$Register, 64-Universe::narrow_klass_shift(), 32);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7278
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7279
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7282
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7283
instruct encodePKlass_not_null_Ex(iRegNdst dst, iRegLsrc base, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7284
  match(Set dst (EncodePKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7285
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7286
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7287
  format %{ "EncodePKlass $dst, $src\t// $src != Null, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7288
  postalloc_expand %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  7289
    encodePKlass_sub_baseNode *n1 = new encodePKlass_sub_baseNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7290
    n1->add_req(n_region, n_base, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7291
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7292
    n1->_opnds[1] = op_base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7293
    n1->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7294
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7295
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  7296
    encodePKlass_shiftNode *n2 = new encodePKlass_shiftNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7297
    n2->add_req(n_region, n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7298
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7299
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7300
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7301
    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
  7302
    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
  7303
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7304
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7305
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7306
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7307
%}
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
// shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7310
instruct encodePKlass_not_null_ExEx(iRegNdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7311
  match(Set dst (EncodePKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7312
  //predicate(Universe::narrow_klass_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7313
  //          true /* TODO: PPC port Universe::narrow_klass_base_overlaps()*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7314
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7315
  //format %{ "EncodePKlass $dst, $src\t// $src != Null, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7316
  ins_cost(DEFAULT_COST*2);  // Don't count constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7317
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7318
    immL baseImm %{ (jlong)(intptr_t)Universe::narrow_klass_base() %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7319
    iRegLdst base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7320
    loadConL_Ex(base, baseImm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7321
    encodePKlass_not_null_Ex(dst, base, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7322
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7323
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7324
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7325
// Decode nodes.
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
// Shift node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7328
instruct decodeNKlass_shift(iRegPdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7329
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7330
  match(Set dst (DecodeNKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7331
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7332
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7333
  format %{ "SLDI    $dst, $src, #3 \t// DecodeNKlass" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7334
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7335
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7336
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7337
    __ sldi($dst$$Register, $src$$Register, Universe::narrow_klass_shift());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7338
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7339
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7340
%}
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
// Add node for expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7343
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7344
instruct decodeNKlass_add_base(iRegPdst dst, iRegLsrc base, iRegPdst src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7345
  // The match rule is needed to make it a 'MachTypeNode'!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7346
  match(Set dst (DecodeNKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7347
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7348
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7349
  format %{ "ADD     $dst, $base, $src \t// DecodeNKlass, add klass base" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7350
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7351
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7352
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7353
    __ add($dst$$Register, $base$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7356
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7357
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7358
// src != 0, shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7359
instruct decodeNKlass_notNull_addBase_Ex(iRegPdst dst, iRegLsrc base, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7360
  match(Set dst (DecodeNKlass (Binary base src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7361
  //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
  7362
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7363
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7364
  format %{ "DecodeNKlass $dst =  $base + ($src << 3) \t// $src != NULL, postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7365
  postalloc_expand %{
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  7366
    decodeNKlass_add_baseNode *n1 = new decodeNKlass_add_baseNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7367
    n1->add_req(n_region, n_base, n_src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7368
    n1->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7369
    n1->_opnds[1] = op_base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7370
    n1->_opnds[2] = op_src;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7371
    n1->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7372
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
  7373
    decodeNKlass_shiftNode *n2 = new decodeNKlass_shiftNode();
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7374
    n2->add_req(n_region, n1);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7375
    n2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7376
    n2->_opnds[1] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7377
    n2->_bottom_type = _bottom_type;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7378
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7379
    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
  7380
    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
  7381
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7382
    nodes->push(n1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7383
    nodes->push(n2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7384
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7385
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7386
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7387
// src != 0, shift != 0, base != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7388
instruct decodeNKlass_notNull_addBase_ExEx(iRegPdst dst, iRegNsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7389
  match(Set dst (DecodeNKlass src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7390
  // predicate(Universe::narrow_klass_shift() != 0 &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7391
  //           Universe::narrow_klass_base() != 0);
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
  //format %{ "DecodeNKlass $dst, $src \t// $src != NULL, expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7394
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7395
  ins_cost(DEFAULT_COST*2);  // Don't count constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7396
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7397
    // 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
  7398
    // But we have to load the base pre-shifted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7399
    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
  7400
    iRegLdst base;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7401
    loadConL_Ex(base, baseImm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7402
    decodeNKlass_notNull_addBase_Ex(dst, base, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7403
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7404
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7405
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7406
//----------MemBar Instructions-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7407
// Memory barrier flavors
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7408
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7409
instruct membar_acquire() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7410
  match(LoadFence);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7411
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7412
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7413
  format %{ "MEMBAR-acquire" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7414
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7415
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7416
    // TODO: PPC port $archOpcode(ppc64Opcode_lwsync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7417
    __ acquire();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7418
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7419
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7420
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7421
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7422
instruct unnecessary_membar_acquire() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7423
  match(MemBarAcquire);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7424
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7425
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7426
  format %{ " -- \t// redundant MEMBAR-acquire - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7427
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7428
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7429
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7430
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7431
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7432
instruct membar_acquire_lock() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7433
  match(MemBarAcquireLock);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7434
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7435
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7436
  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
  7437
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7438
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7439
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7440
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7441
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7442
instruct membar_release() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7443
  match(MemBarRelease);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7444
  match(StoreFence);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7445
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7446
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7447
  format %{ "MEMBAR-release" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7448
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7449
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7450
    // TODO: PPC port $archOpcode(ppc64Opcode_lwsync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7451
    __ release();
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7454
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7455
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7456
instruct membar_storestore() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7457
  match(MemBarStoreStore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7458
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7459
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7460
  format %{ "MEMBAR-store-store" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7461
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7462
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7463
    // TODO: PPC port $archOpcode(ppc64Opcode_lwsync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7464
    __ membar(Assembler::StoreStore);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7465
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7466
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7467
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7468
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7469
instruct membar_release_lock() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7470
  match(MemBarReleaseLock);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7471
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7472
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7473
  format %{ " -- \t// redundant MEMBAR-release - empty (release in FastUnlock)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7474
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7475
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7476
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7477
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7478
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7479
instruct membar_volatile() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7480
  match(MemBarVolatile);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7481
  ins_cost(4*MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7482
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7483
  format %{ "MEMBAR-volatile" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7484
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7485
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7486
    // TODO: PPC port $archOpcode(ppc64Opcode_sync);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7487
    __ fence();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7488
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7489
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7490
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7491
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7492
// This optimization is wrong on PPC. The following pattern is not supported:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7493
//  MemBarVolatile
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7494
//   ^        ^
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7495
//   |        |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7496
//  CtrlProj MemProj
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7497
//   ^        ^
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7498
//   |        |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7499
//   |       Load
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7500
//   |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7501
//  MemBarVolatile
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7502
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7503
//  The first MemBarVolatile could get optimized out! According to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7504
//  Vladimir, this pattern can not occur on Oracle platforms.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7505
//  However, it does occur on PPC64 (because of membars in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7506
//  inline_unsafe_load_store).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7507
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7508
// 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
  7509
// 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
  7510
// we did other fixes in that method.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7511
//instruct unnecessary_membar_volatile() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7512
//  match(MemBarVolatile);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7513
//  predicate(Matcher::post_store_load_barrier(n));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7514
//  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7515
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7516
//  format %{ " -- \t// redundant MEMBAR-volatile - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7517
//  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7518
//  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7519
//  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7520
//%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7521
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7522
instruct membar_CPUOrder() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7523
  match(MemBarCPUOrder);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7524
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7525
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7526
  format %{ " -- \t// MEMBAR-CPUOrder - empty: PPC64 processors are self-consistent." %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7527
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7528
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7529
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7530
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7531
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7532
//----------Conditional Move---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7533
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7534
// Cmove using isel.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7535
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
  7536
  match(Set dst (CMoveI (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7537
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7538
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7539
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7540
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7541
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7542
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7543
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7544
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7545
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7546
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7547
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7548
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7549
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7550
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7551
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7552
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7553
instruct cmovI_reg(cmpOp cmp, flagsRegSrc crx, iRegIdst dst, iRegIsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7554
  match(Set dst (CMoveI (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7555
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7556
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7557
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7558
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7559
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7560
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7561
  // Worst case is branch + move + stop, no stop without scheduler
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7562
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7563
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7564
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7565
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7566
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7567
instruct cmovI_imm(cmpOp cmp, flagsRegSrc crx, iRegIdst dst, immI16 src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7568
  match(Set dst (CMoveI (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7569
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7570
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7571
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7572
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7573
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7574
  // Worst case is branch + move + stop, no stop without scheduler
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7575
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7576
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7577
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7578
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7579
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7580
// Cmove using isel.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7581
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
  7582
  match(Set dst (CMoveL (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7583
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7584
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7585
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7586
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7587
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7588
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7589
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7590
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7591
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7592
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7593
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7594
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7595
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7596
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7597
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7598
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7599
instruct cmovL_reg(cmpOp cmp, flagsRegSrc crx, iRegLdst dst, iRegLsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7600
  match(Set dst (CMoveL (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7601
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7602
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7603
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7604
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7605
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7606
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7607
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7608
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7609
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7610
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7611
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7612
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7613
instruct cmovL_imm(cmpOp cmp, flagsRegSrc crx, iRegLdst dst, immL16 src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7614
  match(Set dst (CMoveL (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7615
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7616
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7617
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7618
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7619
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7620
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7621
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7622
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7623
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7624
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7625
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7626
// Cmove using isel.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7627
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
  7628
  match(Set dst (CMoveN (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7629
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7630
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7631
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7632
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7633
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7634
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7635
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7636
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7637
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7638
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7639
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7640
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7641
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7642
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7643
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7644
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7645
// Conditional move for RegN. Only cmov(reg, reg).
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7646
instruct cmovN_reg(cmpOp cmp, flagsRegSrc crx, iRegNdst dst, iRegNsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7647
  match(Set dst (CMoveN (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7648
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7649
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7650
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7651
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7652
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7653
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7654
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7655
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7656
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7657
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7658
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7659
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7660
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
  7661
  match(Set dst (CMoveN (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7662
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7663
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7664
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7665
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7666
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7667
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7668
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7669
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7670
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7671
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7672
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7673
// Cmove using isel.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7674
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
  7675
  match(Set dst (CMoveP (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7676
  predicate(VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7677
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7678
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7679
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7680
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7681
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7682
    // This is a Power7 instruction for which no machine description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7683
    // exists. Anyways, the scheduler should be off on Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7684
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7685
    int cc        = $cmp$$cmpcode;
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  7686
    __ isel($dst$$Register, $crx$$CondRegister,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7687
            (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7688
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7689
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7690
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7691
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7692
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
  7693
  match(Set dst (CMoveP (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7694
  predicate(!VM_Version::has_isel());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7695
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7696
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7697
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7698
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7699
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7700
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7701
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7702
  ins_encode( enc_cmove_reg(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7703
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7704
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7705
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7706
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
  7707
  match(Set dst (CMoveP (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7708
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7709
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7710
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7711
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7712
  format %{ "CMOVE   $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7713
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7714
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7715
  ins_encode( enc_cmove_imm(dst, crx, src, cmp) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7716
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7717
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7718
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7719
instruct cmovF_reg(cmpOp cmp, flagsRegSrc crx, regF dst, regF src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7720
  match(Set dst (CMoveF (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7721
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7722
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7723
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7724
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7725
  format %{ "CMOVEF  $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7726
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7727
  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
  7728
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7729
    // TODO: PPC port $archOpcode(ppc64Opcode_cmovef);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7730
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7731
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7732
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7733
    __ 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
  7734
    __ fmr($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7735
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7736
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7737
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7738
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7739
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7740
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7741
instruct cmovD_reg(cmpOp cmp, flagsRegSrc crx, regD dst, regD src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7742
  match(Set dst (CMoveD (Binary cmp crx) (Binary dst src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7743
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7744
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7745
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7746
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7747
  format %{ "CMOVEF  $cmp, $crx, $dst, $src\n\t" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7748
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7749
  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
  7750
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7751
    // TODO: PPC port $archOpcode(ppc64Opcode_cmovef);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7752
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7753
    assert((Assembler::bcondCRbiIs1 & ~Assembler::bcondCRbiIs0) == 8, "check encoding");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7754
    // Branch if not (cmp crx).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7755
    __ 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
  7756
    __ fmr($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7757
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7758
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7759
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7760
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7761
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7762
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7763
//----------Conditional_store--------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7764
// Conditional-store of the updated heap-top.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7765
// Used during allocation of the shared heap.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7766
// Sets flags (EQ) on success. Implemented with a CASA on Sparc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7767
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7768
// As compareAndSwapL, but return flag register instead of boolean value in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7769
// int register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7770
// Used by sun/misc/AtomicLongCSImpl.java.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7771
// 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
  7772
// 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
  7773
// can be rematerialized which leads to errors.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7774
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
  7775
  match(Set crx (StoreLConditional mem_ptr (Binary oldVal newVal)));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7776
  effect(TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7777
  format %{ "CMPXCHGD if ($crx = ($oldVal == *$mem_ptr)) *mem_ptr = $newVal; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7778
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7779
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7780
    __ 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
  7781
                MacroAssembler::MemBarAcq, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7782
                noreg, NULL, true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7783
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7784
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7785
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7786
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7787
// As compareAndSwapP, but return flag register instead of boolean value in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7788
// int register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7789
// This instruction is matched if UseTLAB is off.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7790
// 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
  7791
// 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
  7792
// can be rematerialized which leads to errors.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7793
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
  7794
  match(Set cr0 (StorePConditional mem_ptr (Binary oldVal newVal)));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7795
  ins_cost(2*MEMORY_REF_COST);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7796
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7797
  format %{ "STDCX_  if ($cr0 = ($oldVal == *$mem_ptr)) *mem_ptr = $newVal; as bool" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7798
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7799
    // TODO: PPC port $archOpcode(ppc64Opcode_stdcx_);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7800
    __ stdcx_($newVal$$Register, $mem_ptr$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7801
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7802
  ins_pipe(pipe_class_memory);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7803
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7804
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7805
// Implement LoadPLocked. Must be ordered against changes of the memory location
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7806
// by storePConditional.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7807
// Don't know whether this is ever used.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7808
instruct loadPLocked(iRegPdst dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7809
  match(Set dst (LoadPLocked mem));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7810
  ins_cost(2*MEMORY_REF_COST);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7811
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7812
  format %{ "LDARX   $dst, $mem \t// loadPLocked\n\t" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7813
  size(4);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7814
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7815
    // TODO: PPC port $archOpcode(ppc64Opcode_ldarx);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7816
    __ ldarx($dst$$Register, $mem$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7817
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7818
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7819
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7820
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7821
//----------Compare-And-Swap---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7822
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7823
// CompareAndSwap{P,I,L} have more than one output, therefore "CmpI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7824
// (CompareAndSwap ...)" or "If (CmpI (CompareAndSwap ..))"  cannot be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7825
// matched.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7826
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7827
// Strong versions:
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7828
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7829
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
  7830
  match(Set res (CompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7831
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7832
  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
  7833
  format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7834
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7835
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7836
    // 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
  7837
    __ 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
  7838
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7839
                $res$$Register, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7840
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7841
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7842
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7843
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7844
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7845
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7846
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7847
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7848
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7849
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
  7850
  match(Set res (CompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7851
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7852
  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
  7853
  format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7854
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7855
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7856
    // 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
  7857
    __ 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
  7858
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7859
                $res$$Register, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7860
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7861
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7862
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7863
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7864
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7865
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7866
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7867
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7868
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7869
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
  7870
  match(Set res (CompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7871
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7872
  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
  7873
  format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7874
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7875
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7876
    // 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
  7877
    __ 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
  7878
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7879
                $res$$Register, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7880
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7881
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7882
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7883
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7884
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7885
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7886
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7887
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7888
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7889
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
  7890
  match(Set res (CompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7891
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7892
  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
  7893
  format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7894
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7895
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7896
    // 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
  7897
    __ 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
  7898
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7899
                $res$$Register, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7900
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7901
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7902
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7903
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7904
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7905
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7906
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7907
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7908
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7909
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
  7910
  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
  7911
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7912
  format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7913
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7914
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7915
    // 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
  7916
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7917
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7918
                $res$$Register, true);
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7919
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7920
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7921
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7922
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7923
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7924
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7925
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7926
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7927
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7928
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
  7929
  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
  7930
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7931
  format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7932
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7933
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7934
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7935
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7936
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7937
                $res$$Register, true);
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7938
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7939
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7940
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7941
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7942
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7943
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7944
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7945
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7946
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7947
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
  7948
  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
  7949
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7950
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7951
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7952
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7953
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7954
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7955
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7956
                $res$$Register, NULL, true);
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7957
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7958
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7959
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7960
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7961
    }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7962
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7963
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7964
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7965
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  7966
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
  7967
  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
  7968
  effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7969
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7970
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7971
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7972
    // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7973
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7974
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  7975
                $res$$Register, NULL, true);
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7976
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7977
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7978
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7979
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7980
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7981
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7982
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7983
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7984
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7985
// Weak versions:
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  7986
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7987
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
  7988
  match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7989
  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
  7990
  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
  7991
  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
  7992
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7993
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7994
    // 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
  7995
    __ 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
  7996
                MacroAssembler::MemBarNone,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7997
                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
  7998
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  7999
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8000
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8001
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8002
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
  8003
  match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8004
  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
  8005
  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
  8006
  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
  8007
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8008
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8009
    // 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
  8010
    __ 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
  8011
                MacroAssembler::MemBarNone,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8012
                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
  8013
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8014
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8015
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8016
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8017
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
  8018
  match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8019
  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
  8020
  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
  8021
  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
  8022
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8023
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8024
    // 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
  8025
    __ 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
  8026
                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
  8027
                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
  8028
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8029
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8030
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8031
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8032
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
  8033
  match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8034
  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
  8035
  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
  8036
  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
  8037
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8038
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8039
    // 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
  8040
    __ 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
  8041
                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
  8042
                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
  8043
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8044
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8045
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8046
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8047
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
  8048
  match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8049
  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
  8050
  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
  8051
  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
  8052
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8053
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8054
    // 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
  8055
    __ 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
  8056
                MacroAssembler::MemBarNone,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8057
                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
  8058
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8059
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8060
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8061
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8062
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
  8063
  match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8064
  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
  8065
  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
  8066
  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
  8067
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8068
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8069
    // 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
  8070
    __ 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
  8071
                MacroAssembler::MemBarNone,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8072
                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
  8073
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8074
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8075
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8076
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8077
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
  8078
  match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8079
  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
  8080
  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
  8081
  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
  8082
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8083
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8084
    // 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
  8085
    __ 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
  8086
                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
  8087
                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
  8088
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8089
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8090
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8091
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8092
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
  8093
  match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8094
  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
  8095
  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
  8096
  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
  8097
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8098
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8099
    // 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
  8100
    __ 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
  8101
                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
  8102
                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
  8103
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8104
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8105
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8106
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8107
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
  8108
  match(Set res (WeakCompareAndSwapI mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8109
  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
  8110
  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
  8111
  format %{ "weak CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8112
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8113
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8114
    // 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
  8115
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8116
                MacroAssembler::MemBarNone,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8117
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
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
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8120
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8121
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8122
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
  8123
  match(Set res (WeakCompareAndSwapI mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8124
  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
  8125
  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
  8126
  format %{ "weak CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8127
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8128
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8129
    // 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
  8130
    // 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
  8131
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8132
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8133
                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
  8134
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8135
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8136
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8137
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8138
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8139
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
  8140
  match(Set res (WeakCompareAndSwapN mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8141
  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
  8142
  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
  8143
  format %{ "weak CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8144
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8145
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8146
    // 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
  8147
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8148
                MacroAssembler::MemBarNone,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8149
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8150
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8151
  ins_pipe(pipe_class_default);
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
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8154
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
  8155
  match(Set res (WeakCompareAndSwapN mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8156
  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
  8157
  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
  8158
  format %{ "weak CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8159
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8160
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8161
    // 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
  8162
    // 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
  8163
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8164
    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8165
                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
  8166
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8167
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8168
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8169
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8170
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8171
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
  8172
  match(Set res (WeakCompareAndSwapL mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8173
  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
  8174
  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
  8175
  format %{ "weak CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8176
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8177
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8178
    // 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
  8179
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8180
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8181
                MacroAssembler::MemBarNone,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8182
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, NULL, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8183
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8184
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8185
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8186
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8187
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
  8188
  match(Set res (WeakCompareAndSwapL mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8189
  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
  8190
  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
  8191
  format %{ "weak CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as bool" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8192
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8193
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8194
    // 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
  8195
    // 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
  8196
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8197
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8198
                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
  8199
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, NULL, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8200
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8201
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8202
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8203
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8204
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
  8205
  match(Set res (WeakCompareAndSwapP mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8206
  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
  8207
  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
  8208
  format %{ "weak CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8209
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8210
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8211
    // 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
  8212
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8213
                MacroAssembler::MemBarNone,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8214
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, NULL, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8215
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8216
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8217
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8218
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8219
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
  8220
  match(Set res (WeakCompareAndSwapP mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8221
  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
  8222
  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
  8223
  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
  8224
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8225
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8226
    // 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
  8227
    // 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
  8228
    // value is never passed to caller.
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8229
    __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8230
                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
  8231
                MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, NULL, true, /*weak*/ true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8232
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8233
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8234
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8235
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8236
// CompareAndExchange
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8237
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8238
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
  8239
  match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8240
  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
  8241
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8242
  format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8243
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8244
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8245
    // 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
  8246
    __ 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
  8247
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8248
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8249
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8250
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8251
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8252
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8253
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
  8254
  match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8255
  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
  8256
  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
  8257
  format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8258
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8259
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8260
    // 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
  8261
    __ 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
  8262
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8263
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8264
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8265
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8266
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8267
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8268
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
  8269
  match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8270
  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
  8271
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8272
  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
  8273
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8274
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8275
    // 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
  8276
    __ 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
  8277
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8278
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8279
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8280
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8281
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8282
      // 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
  8283
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8284
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8285
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8286
  ins_pipe(pipe_class_default);
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
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
  8290
  match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8291
  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
  8292
  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
  8293
  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
  8294
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8295
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8296
    // 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
  8297
    __ 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
  8298
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8299
                noreg, true);
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
      // 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
  8304
      __ sync();
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
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8307
  ins_pipe(pipe_class_default);
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
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8310
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
  8311
  match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8312
  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
  8313
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8314
  format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as int" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8315
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8316
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8317
    // 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
  8318
    __ 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
  8319
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8320
                noreg, true);
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
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8323
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8324
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8325
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
  8326
  match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8327
  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
  8328
  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
  8329
  format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as int" %}
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
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8332
    // 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
  8333
    __ 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
  8334
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8335
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8336
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8337
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8338
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8339
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8340
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
  8341
  match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8342
  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
  8343
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8344
  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
  8345
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8346
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8347
    // 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
  8348
    __ 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
  8349
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8350
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8351
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8352
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8353
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8354
      // 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
  8355
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8356
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8357
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8358
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8359
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8360
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8361
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
  8362
  match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8363
  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
  8364
  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
  8365
  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
  8366
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8367
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8368
    // 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
  8369
    __ 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
  8370
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8371
                noreg, true);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8372
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8373
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8374
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8375
      // 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
  8376
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8377
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8378
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8379
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8380
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8381
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8382
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
  8383
  match(Set res (CompareAndExchangeI mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8384
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8385
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8386
  format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as int" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8387
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8388
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8389
    // 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
  8390
    __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8391
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8392
                noreg, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8393
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8394
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8395
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8396
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8397
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
  8398
  match(Set res (CompareAndExchangeI mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8399
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8400
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8401
  format %{ "CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as int" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8402
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8403
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8404
    // 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
  8405
    __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8406
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8407
                noreg, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8408
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8409
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8410
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8411
      // 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
  8412
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8413
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8414
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8415
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8416
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8417
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8418
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
  8419
  match(Set res (CompareAndExchangeN mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8420
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8421
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8422
  format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as narrow oop" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8423
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8424
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8425
    // 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
  8426
    __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8427
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8428
                noreg, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8429
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8430
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8431
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8432
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8433
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
  8434
  match(Set res (CompareAndExchangeN mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8435
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8436
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8437
  format %{ "CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as narrow oop" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8438
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8439
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8440
    // 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
  8441
    __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8442
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8443
                noreg, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8444
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8445
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8446
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8447
      // 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
  8448
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8449
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8450
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8451
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8452
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8453
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8454
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
  8455
  match(Set res (CompareAndExchangeL mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8456
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8457
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8458
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as long" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8459
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8460
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8461
    // 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
  8462
    __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8463
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8464
                noreg, NULL, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8465
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8466
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8467
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8468
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8469
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
  8470
  match(Set res (CompareAndExchangeL mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8471
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8472
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8473
  format %{ "CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as long" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8474
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8475
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8476
    // 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
  8477
    __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8478
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8479
                noreg, NULL, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8480
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8481
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8482
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8483
      // 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
  8484
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8485
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8486
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8487
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8488
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8489
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8490
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
  8491
  match(Set res (CompareAndExchangeP mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8492
  predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8493
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8494
  format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as ptr; ptr" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8495
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8496
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8497
    // 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
  8498
    __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8499
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8500
                noreg, NULL, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8501
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8502
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8503
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8504
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8505
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
  8506
  match(Set res (CompareAndExchangeP mem_ptr (Binary src1 src2)));
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8507
  predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8508
  effect(TEMP_DEF res, TEMP cr0);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8509
  format %{ "CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as ptr; ptr" %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8510
  ins_encode %{
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8511
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8512
    // 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
  8513
    __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8514
                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8515
                noreg, NULL, true);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8516
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8517
      __ isync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8518
    } else {
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8519
      // 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
  8520
      __ sync();
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8521
    }
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8522
  %}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8523
  ins_pipe(pipe_class_default);
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8524
%}
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8525
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38286
diff changeset
  8526
// Special RMW
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8527
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8528
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
  8529
  match(Set res (GetAndAddB mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8530
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8531
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8532
  format %{ "GetAndAddB $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8533
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8534
    __ getandaddb($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8535
                  R0, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8536
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8537
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8538
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8539
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8540
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8541
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8542
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8543
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8544
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8545
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
  8546
  match(Set res (GetAndAddB mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8547
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8548
  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
  8549
  format %{ "GetAndAddB $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8550
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8551
    __ getandaddb($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8552
                  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
  8553
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8554
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8555
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8556
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8557
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8558
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8559
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8560
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8561
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8562
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
  8563
  match(Set res (GetAndAddS mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8564
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8565
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8566
  format %{ "GetAndAddS $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8567
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8568
    __ getandaddh($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8569
                  R0, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8570
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8571
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8572
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8573
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8574
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8575
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8576
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8577
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8578
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8579
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
  8580
  match(Set res (GetAndAddS mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8581
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8582
  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
  8583
  format %{ "GetAndAddS $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8584
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8585
    __ getandaddh($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8586
                  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
  8587
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8588
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8589
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8590
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8591
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8592
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8593
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8594
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8595
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8596
instruct getAndAddI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8597
  match(Set res (GetAndAddI mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8598
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8599
  format %{ "GetAndAddI $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8600
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8601
    __ getandaddw($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8602
                  R0, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8603
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8604
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8605
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8606
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8607
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8608
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8609
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8610
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8611
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8612
instruct getAndAddL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8613
  match(Set res (GetAndAddL mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8614
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8615
  format %{ "GetAndAddL $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8616
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8617
    __ getandaddd($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8618
                  R0, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8619
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8620
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8621
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8622
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8623
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8624
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8625
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8626
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8627
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8628
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
  8629
  match(Set res (GetAndSetB mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8630
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8631
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8632
  format %{ "GetAndSetB $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8633
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8634
    __ getandsetb($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8635
                  noreg, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8636
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8637
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8638
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8639
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8640
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8641
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8642
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8643
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8644
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8645
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
  8646
  match(Set res (GetAndSetB mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8647
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8648
  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
  8649
  format %{ "GetAndSetB $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8650
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8651
    __ getandsetb($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8652
                  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
  8653
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8654
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8655
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8656
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8657
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8658
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8659
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8660
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8661
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8662
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
  8663
  match(Set res (GetAndSetS mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8664
  predicate(VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8665
  effect(TEMP_DEF res, TEMP cr0);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8666
  format %{ "GetAndSetS $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8667
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8668
    __ getandseth($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8669
                  noreg, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8670
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8671
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8672
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8673
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8674
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8675
  %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8676
  ins_pipe(pipe_class_default);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8677
%}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8678
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8679
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
  8680
  match(Set res (GetAndSetS mem_ptr src));
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8681
  predicate(!VM_Version::has_lqarx());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8682
  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
  8683
  format %{ "GetAndSetS $res, $mem_ptr, $src" %}
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8684
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8685
    __ getandseth($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8686
                  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
  8687
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8688
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8689
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8690
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8691
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8692
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8693
  ins_pipe(pipe_class_default);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8696
instruct getAndSetI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8697
  match(Set res (GetAndSetI mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8698
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8699
  format %{ "GetAndSetI $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8700
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8701
    __ getandsetw($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8702
                  MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8703
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8704
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8705
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8706
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8707
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8708
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8709
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8710
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8711
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8712
instruct getAndSetL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8713
  match(Set res (GetAndSetL mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8714
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8715
  format %{ "GetAndSetL $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8716
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8717
    __ getandsetd($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8718
                  MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8719
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8720
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8721
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8722
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8723
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8724
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8725
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8726
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8727
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8728
instruct getAndSetP(iRegPdst res, iRegPdst mem_ptr, iRegPsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8729
  match(Set res (GetAndSetP mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8730
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8731
  format %{ "GetAndSetP $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8732
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8733
    __ getandsetd($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8734
                  MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8735
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8736
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8737
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8738
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8739
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8740
  %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8741
  ins_pipe(pipe_class_default);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8744
instruct getAndSetN(iRegNdst res, iRegPdst mem_ptr, iRegNsrc src, flagsRegCR0 cr0) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8745
  match(Set res (GetAndSetN mem_ptr src));
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8746
  effect(TEMP_DEF res, TEMP cr0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8747
  format %{ "GetAndSetN $res, $mem_ptr, $src" %}
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8748
  ins_encode %{
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8749
    __ getandsetw($res$$Register, $src$$Register, $mem_ptr$$Register,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8750
                  MacroAssembler::cmpxchgx_hint_atomic_update());
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8751
    if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8752
      __ isync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8753
    } else {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8754
      __ sync();
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8755
    }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 39424
diff changeset
  8756
  %}
22861
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
//----------Arithmetic Instructions--------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8761
// Addition Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8762
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8763
// Register Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8764
instruct addI_reg_reg(iRegIdst dst, iRegIsrc_iRegL2Isrc src1, iRegIsrc_iRegL2Isrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8765
  match(Set dst (AddI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8766
  format %{ "ADD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8767
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8768
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8769
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8770
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8773
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8774
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8775
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8776
instruct addI_reg_reg_2(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8777
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8778
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8779
  format %{ "ADD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8780
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8781
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8782
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8783
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8784
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8785
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8788
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
  8789
  match(Set dst (AddI (AddI (AddI src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8790
  ins_cost(DEFAULT_COST*3);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8793
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8794
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8795
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8796
    addI_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8797
    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
  8798
    addI_reg_reg(dst, tmp1, tmp2);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8802
// Immediate Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8803
instruct addI_reg_imm16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8804
  match(Set dst (AddI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8805
  format %{ "ADDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8806
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8807
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8808
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8809
    __ addi($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8810
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8811
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8812
%}
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
// Immediate Addition with 16-bit shifted operand
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8815
instruct addI_reg_immhi16(iRegIdst dst, iRegIsrc src1, immIhi16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8816
  match(Set dst (AddI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8817
  format %{ "ADDIS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8818
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8819
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8820
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8821
    __ addis($dst$$Register, $src1$$Register, ($src2$$constant)>>16);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8824
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8825
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8826
// Long Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8827
instruct addL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8828
  match(Set dst (AddL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8829
  format %{ "ADD     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8830
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8831
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8832
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8833
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8834
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8835
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8836
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8837
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8838
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8839
instruct addL_reg_reg_2(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8840
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8841
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8842
  format %{ "ADD     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8843
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8844
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8845
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8846
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8847
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8848
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8849
%}
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
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
  8852
  match(Set dst (AddL (AddL (AddL src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8853
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8854
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8855
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8856
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8857
    iRegLdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8858
    iRegLdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8859
    addL_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8860
    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
  8861
    addL_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8862
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8863
%}
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
// AddL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8866
instruct addI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8867
  match(Set dst (ConvL2I (AddL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8868
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8869
  format %{ "ADD     $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8870
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8871
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8872
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8873
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8874
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8875
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8878
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8879
instruct addL_reg_imm16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8880
  match(Set dst (AddL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8881
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8882
  format %{ "ADDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8883
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8884
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8885
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8886
    __ addi($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8887
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8888
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8889
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8890
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8891
// Long Immediate Addition with 16-bit shifted operand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8892
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8893
instruct addL_reg_immhi16(iRegLdst dst, iRegLsrc src1, immL32hi16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8894
  match(Set dst (AddL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8895
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8896
  format %{ "ADDIS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8897
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8898
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8899
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8900
    __ addis($dst$$Register, $src1$$Register, ($src2$$constant)>>16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8901
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8902
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8903
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8904
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8905
// Pointer Register Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8906
instruct addP_reg_reg(iRegPdst dst, iRegP_N2P src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8907
  match(Set dst (AddP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8908
  format %{ "ADD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8909
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8910
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8911
    // TODO: PPC port $archOpcode(ppc64Opcode_add);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8912
    __ add($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8915
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8916
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8917
// Pointer Immediate Addition
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8918
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8919
instruct addP_reg_imm16(iRegPdst dst, iRegP_N2P src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8920
  match(Set dst (AddP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8921
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8922
  format %{ "ADDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8923
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8924
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8925
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8926
    __ addi($dst$$Register, $src1$$Register, $src2$$constant);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8929
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8930
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8931
// Pointer Immediate Addition with 16-bit shifted operand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8932
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8933
instruct addP_reg_immhi16(iRegPdst dst, iRegP_N2P src1, immL32hi16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8934
  match(Set dst (AddP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8935
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8936
  format %{ "ADDIS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8937
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8938
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8939
    // TODO: PPC port $archOpcode(ppc64Opcode_addis);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8940
    __ addis($dst$$Register, $src1$$Register, ($src2$$constant)>>16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8941
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8942
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8943
%}
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
// Subtraction Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8947
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8948
// Register Subtraction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8949
instruct subI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8950
  match(Set dst (SubI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8951
  format %{ "SUBF    $dst, $src2, $src1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8952
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8953
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8954
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8955
    __ subf($dst$$Register, $src2$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8956
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8957
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8958
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8959
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8960
// Immediate Subtraction
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8961
// Immediate Subtraction: The compiler converts "x-c0" into "x+ -c0" (see SubLNode::Ideal),
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  8962
// 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
  8963
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8964
// SubI from constant (using subfic).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8965
instruct subI_imm16_reg(iRegIdst dst, immI16 src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8966
  match(Set dst (SubI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8967
  format %{ "SUBI    $dst, $src1, $src2" %}
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
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8970
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8971
    // TODO: PPC port $archOpcode(ppc64Opcode_subfic);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8972
    __ subfic($dst$$Register, $src2$$Register, $src1$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8973
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8974
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8977
// 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
  8978
// positive integers and 0xF...F for negative ones.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8979
instruct signmask32I_regI(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8980
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8981
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8982
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8983
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8984
  format %{ "SRAWI   $dst, $src, #31" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8985
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8986
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8987
    // TODO: PPC port $archOpcode(ppc64Opcode_srawi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8988
    __ srawi($dst$$Register, $src$$Register, 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8989
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8990
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8991
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8992
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8993
instruct absI_reg_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8994
  match(Set dst (AbsI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8995
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8996
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8997
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8998
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  8999
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9000
    signmask32I_regI(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9001
    xorI_reg_reg(tmp2, tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9002
    subI_reg_reg(dst, tmp2, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9003
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9004
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9005
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9006
instruct negI_regI(iRegIdst dst, immI_0 zero, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9007
  match(Set dst (SubI zero src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9008
  format %{ "NEG     $dst, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9009
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9010
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9011
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9012
    __ neg($dst$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9015
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9016
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9017
// Long subtraction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9018
instruct subL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9019
  match(Set dst (SubL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9020
  format %{ "SUBF    $dst, $src2, $src1 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9021
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9022
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9023
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9024
    __ subf($dst$$Register, $src2$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9025
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9026
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9029
// SubL + convL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9030
instruct subI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9031
  match(Set dst (ConvL2I (SubL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9032
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9033
  format %{ "SUBF    $dst, $src2, $src1 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9034
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9035
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9036
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9037
    __ subf($dst$$Register, $src2$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9038
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9039
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9042
// 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
  9043
// positive longs and 0xF...F for negative ones.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9044
instruct signmask64I_regL(iRegIdst dst, iRegLsrc src) %{
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9045
  // no match-rule, false predicate
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9046
  effect(DEF dst, USE src);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9047
  predicate(false);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9048
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9049
  format %{ "SRADI   $dst, $src, #63" %}
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9050
  size(4);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9051
  ins_encode %{
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9052
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9053
    __ sradi($dst$$Register, $src$$Register, 0x3f);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9054
  %}
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9055
  ins_pipe(pipe_class_default);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9056
%}
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9057
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9058
// 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
  9059
// positive longs and 0xF...F for negative ones.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
  9060
instruct signmask64L_regL(iRegLdst dst, iRegLsrc src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9061
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9062
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9063
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9064
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9065
  format %{ "SRADI   $dst, $src, #63" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9066
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9067
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9068
    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9069
    __ sradi($dst$$Register, $src$$Register, 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9070
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9071
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9072
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9073
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9074
// Long negation
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9075
instruct negL_reg_reg(iRegLdst dst, immL_0 zero, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9076
  match(Set dst (SubL zero src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9077
  format %{ "NEG     $dst, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9078
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9079
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9080
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9081
    __ neg($dst$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9082
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9083
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9084
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9085
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9086
// NegL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9087
instruct negI_con0_regL(iRegIdst dst, immL_0 zero, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9088
  match(Set dst (ConvL2I (SubL zero src2)));
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
  format %{ "NEG     $dst, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9091
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9092
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9093
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9094
    __ neg($dst$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9095
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9096
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9097
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9098
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9099
// Multiplication Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9100
// Integer Multiplication
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
// Register Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9103
instruct mulI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9104
  match(Set dst (MulI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9105
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9106
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9107
  format %{ "MULLW   $dst, $src1, $src2" %}
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
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9110
    // TODO: PPC port $archOpcode(ppc64Opcode_mullw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9111
    __ mullw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9112
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9113
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9114
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9115
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9116
// Immediate Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9117
instruct mulI_reg_imm16(iRegIdst dst, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9118
  match(Set dst (MulI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9119
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9120
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9121
  format %{ "MULLI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9122
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9123
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9124
    // TODO: PPC port $archOpcode(ppc64Opcode_mulli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9125
    __ mulli($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9126
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9127
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9130
instruct mulL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9131
  match(Set dst (MulL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9132
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9133
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9134
  format %{ "MULLD   $dst $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9135
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9136
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9137
    // TODO: PPC port $archOpcode(ppc64Opcode_mulld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9138
    __ mulld($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9139
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9140
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9141
%}
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
// Multiply high for optimized long division by constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9144
instruct mulHighL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9145
  match(Set dst (MulHiL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9146
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9147
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9148
  format %{ "MULHD   $dst $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9149
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9150
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9151
    // TODO: PPC port $archOpcode(ppc64Opcode_mulhd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9152
    __ mulhd($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9153
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9154
  ins_pipe(pipe_class_default);
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
// Immediate Multiplication
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9158
instruct mulL_reg_imm16(iRegLdst dst, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9159
  match(Set dst (MulL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9160
  ins_cost(DEFAULT_COST);
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 %{ "MULLI   $dst, $src1, $src2" %}
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_mulli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9166
    __ mulli($dst$$Register, $src1$$Register, $src2$$constant);
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
// Integer Division with Immediate -1: Negate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9172
instruct divI_reg_immIvalueMinus1(iRegIdst dst, iRegIsrc src1, immI_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9173
  match(Set dst (DivI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9174
  ins_cost(DEFAULT_COST);
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 %{ "NEG     $dst, $src1 \t// /-1" %}
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_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9180
    __ neg($dst$$Register, $src1$$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
// Integer Division with constant, but not -1.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9186
// 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
  9187
// It might well be that src2 is known to be positive.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9188
instruct divI_reg_regnotMinus1(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9189
  match(Set dst (DivI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9190
  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
  9191
  ins_cost(2*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9192
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9193
  format %{ "DIVW    $dst, $src1, $src2 \t// /not-1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9194
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9195
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9196
    // TODO: PPC port $archOpcode(ppc64Opcode_divw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9197
    __ divw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9198
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9199
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9200
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9201
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  9202
instruct cmovI_bne_negI_reg(iRegIdst dst, flagsRegSrc crx, iRegIsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9203
  effect(USE_DEF dst, USE src1, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9204
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9205
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9206
  ins_variable_size_depending_on_alignment(true);
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
  format %{ "CMOVE   $dst, neg($src1), $crx" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9209
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9210
  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
  9211
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9212
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9213
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9214
    __ bne($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9215
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9216
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9217
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9218
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9219
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9222
// Integer Division with Registers not containing constants.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9223
instruct divI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9224
  match(Set dst (DivI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9225
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9226
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9227
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9228
    immI16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9229
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9230
    cmpI_reg_imm16(tmp1, src2, imm);          // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9231
    divI_reg_regnotMinus1(dst, src1, src2);   // dst = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9232
    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
  9233
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9234
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9235
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9236
// Long Division with Immediate -1: Negate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9237
instruct divL_reg_immLvalueMinus1(iRegLdst dst, iRegLsrc src1, immL_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9238
  match(Set dst (DivL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9239
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9240
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9241
  format %{ "NEG     $dst, $src1 \t// /-1, long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9242
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9243
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9244
    // TODO: PPC port $archOpcode(ppc64Opcode_neg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9245
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9246
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9247
  ins_pipe(pipe_class_default);
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
// Long Division with constant, but not -1.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9251
instruct divL_reg_regnotMinus1(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9252
  match(Set dst (DivL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9253
  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
  9254
  ins_cost(2*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9255
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9256
  format %{ "DIVD    $dst, $src1, $src2 \t// /not-1, long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9257
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9258
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9259
    // TODO: PPC port $archOpcode(ppc64Opcode_divd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9260
    __ divd($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9261
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9262
  ins_pipe(pipe_class_default);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  9265
instruct cmovL_bne_negL_reg(iRegLdst dst, flagsRegSrc crx, iRegLsrc src1) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9266
  effect(USE_DEF dst, USE src1, USE crx);
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
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9270
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9271
  format %{ "CMOVE   $dst, neg($src1), $crx" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9272
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9273
  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
  9274
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9275
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9276
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9277
    __ bne($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9278
    __ neg($dst$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9279
    // TODO PPC port __ endgroup_if_needed(_size == 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9280
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9281
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9282
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9283
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9284
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9285
// Long Division with Registers not containing constants.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9286
instruct divL_reg_reg_Ex(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9287
  match(Set dst (DivL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9288
  ins_cost(10*DEFAULT_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9291
    immL16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9292
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9293
    cmpL_reg_imm16(tmp1, src2, imm);          // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9294
    divL_reg_regnotMinus1(dst, src1, src2);   // dst = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9295
    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
  9296
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9297
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9298
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9299
// Integer Remainder with registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9300
instruct modI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9301
  match(Set dst (ModI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9302
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9303
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9304
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9305
    immI16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9306
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9307
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9308
    iRegIdst tmp3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9309
    cmpI_reg_imm16(tmp1, src2, imm);           // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9310
    divI_reg_regnotMinus1(tmp2, src1, src2);   // tmp2 = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9311
    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
  9312
    mulI_reg_reg(tmp3, src2, tmp2);            // tmp3 = src2 * tmp2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9313
    subI_reg_reg(dst, src1, tmp3);             // dst = src1 - tmp3
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9314
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9315
%}
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
// Long Remainder with registers
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
  9318
instruct modL_reg_reg_Ex(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9319
  match(Set dst (ModL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9320
  ins_cost(10*DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9321
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9322
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9323
    immL16 imm %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9324
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9325
    iRegLdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9326
    iRegLdst tmp3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9327
    cmpL_reg_imm16(tmp1, src2, imm);             // check src2 == -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9328
    divL_reg_regnotMinus1(tmp2, src1, src2);     // tmp2 = src1 / src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9329
    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
  9330
    mulL_reg_reg(tmp3, src2, tmp2);              // tmp3 = src2 * tmp2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9331
    subL_reg_reg(dst, src1, tmp3);               // dst = src1 - tmp3
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9332
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9333
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9334
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9335
// Integer Shift Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9336
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9337
// Register Shift Left
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9338
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9339
// Clear all but the lowest #mask bits.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9340
// Used to normalize shift amounts in registers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9341
instruct maskI_reg_imm(iRegIdst dst, iRegIsrc src, uimmI6 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9342
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9343
  effect(DEF dst, USE src, USE mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9344
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9345
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9346
  format %{ "MASK    $dst, $src, $mask \t// clear $mask upper bits" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9347
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9348
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9349
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9350
    __ clrldi($dst$$Register, $src$$Register, $mask$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9351
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9352
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9353
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9354
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9355
instruct lShiftI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9356
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9357
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9358
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9359
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9360
  format %{ "SLW     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9361
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9362
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9363
    // TODO: PPC port $archOpcode(ppc64Opcode_slw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9364
    __ slw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9365
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9366
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9367
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9368
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9369
instruct lShiftI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9370
  match(Set dst (LShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9371
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9372
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9373
    uimmI6 mask %{ 0x3b /* clear 59 bits, keep 5 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9374
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9375
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9376
    lShiftI_reg_reg(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9377
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9378
%}
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
// Register Shift Left Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9381
instruct lShiftI_reg_imm(iRegIdst dst, iRegIsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9382
  match(Set dst (LShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9383
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9384
  format %{ "SLWI    $dst, $src1, ($src2 & 0x1f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9385
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9386
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9387
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9388
    __ slwi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9389
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9390
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9391
%}
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
// AndI with negpow2-constant + LShiftI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9394
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
  9395
  match(Set dst (LShiftI (AndI src1 src2) src3));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9396
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9397
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9398
  format %{ "RLWINM  $dst, lShiftI(AndI($src1, $src2), $src3)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9399
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9400
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9401
    // 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
  9402
    long src2      = $src2$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9403
    long src3      = $src3$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9404
    long maskbits  = src3 + log2_long((jlong) (julong) (juint) -src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9405
    if (maskbits >= 32) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9406
      __ li($dst$$Register, 0); // addi
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9407
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9408
      __ rlwinm($dst$$Register, $src1$$Register, src3 & 0x1f, 0, (31-maskbits) & 0x1f);
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
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9411
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9412
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9413
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9414
// RShiftI + AndI with negpow2-constant + LShiftI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9415
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
  9416
  match(Set dst (LShiftI (AndI (RShiftI src1 src3) src2) src3));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9417
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9418
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9419
  format %{ "RLWINM  $dst, lShiftI(AndI(RShiftI($src1, $src3), $src2), $src3)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9420
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9421
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9422
    // 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
  9423
    long src2      = $src2$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9424
    long src3      = $src3$$constant;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9425
    long maskbits  = src3 + log2_long((jlong) (julong) (juint) -src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9426
    if (maskbits >= 32) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9427
      __ li($dst$$Register, 0); // addi
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9428
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9429
      __ rlwinm($dst$$Register, $src1$$Register, 0, 0, (31-maskbits) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9430
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9431
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9432
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9433
%}
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
instruct lShiftL_regL_regI(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9436
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9437
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9438
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9439
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9440
  format %{ "SLD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9441
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9442
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9443
    // TODO: PPC port $archOpcode(ppc64Opcode_sld);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9444
    __ sld($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9445
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9446
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9449
// Register Shift Left
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9450
instruct lShiftL_regL_regI_Ex(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9451
  match(Set dst (LShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9452
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9453
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9454
    uimmI6 mask %{ 0x3a /* clear 58 bits, keep 6 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9455
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9456
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9457
    lShiftL_regL_regI(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9458
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9459
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9460
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9461
// Register Shift Left Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9462
instruct lshiftL_regL_immI(iRegLdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9463
  match(Set dst (LShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9464
  format %{ "SLDI    $dst, $src1, ($src2 & 0x3f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9465
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9466
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9467
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9468
    __ sldi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9469
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9470
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9473
// If we shift more than 32 bits, we need not convert I2L.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9474
instruct lShiftL_regI_immGE32(iRegLdst dst, iRegIsrc src1, uimmI6_ge32 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9475
  match(Set dst (LShiftL (ConvI2L src1) src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9476
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9477
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9478
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9479
  format %{ "SLDI    $dst, i2l($src1), $src2" %}
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_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9482
    __ sldi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
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
// Shift a postivie int to the left.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9488
// Clrlsldi clears the upper 32 bits and shifts.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9489
instruct scaledPositiveI2L_lShiftL_convI2L_reg_imm6(iRegLdst dst, iRegIsrc src1, uimmI6 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9490
  match(Set dst (LShiftL (ConvI2L src1) src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9491
  predicate(((ConvI2LNode*)(_kids[0]->_leaf))->type()->is_long()->is_positive_int());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9492
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9493
  format %{ "SLDI    $dst, i2l(positive_int($src1)), $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9494
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9495
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9496
    // TODO: PPC port $archOpcode(ppc64Opcode_rldic);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9497
    __ clrlsldi($dst$$Register, $src1$$Register, 0x20, $src2$$constant);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9500
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9501
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9502
instruct arShiftI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9503
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9504
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9505
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9506
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9507
  format %{ "SRAW    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9508
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9509
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9510
    // TODO: PPC port $archOpcode(ppc64Opcode_sraw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9511
    __ sraw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9512
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9513
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9514
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9515
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9516
// Register Arithmetic Shift Right
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9517
instruct arShiftI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9518
  match(Set dst (RShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9519
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9520
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9521
    uimmI6 mask %{ 0x3b /* clear 59 bits, keep 5 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9522
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9523
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9524
    arShiftI_reg_reg(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9525
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9526
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9527
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9528
// Register Arithmetic Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9529
instruct arShiftI_reg_imm(iRegIdst dst, iRegIsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9530
  match(Set dst (RShiftI src1 src2));
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
  format %{ "SRAWI   $dst, $src1, ($src2 & 0x1f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9533
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9534
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9535
    // TODO: PPC port $archOpcode(ppc64Opcode_srawi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9536
    __ srawi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9537
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9538
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9539
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9540
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9541
instruct arShiftL_regL_regI(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9542
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9543
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9544
  predicate(false);
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
  format %{ "SRAD    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9547
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9548
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9549
    // TODO: PPC port $archOpcode(ppc64Opcode_srad);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9550
    __ srad($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9551
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9552
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9555
// Register Shift Right Arithmetic Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9556
instruct arShiftL_regL_regI_Ex(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9557
  match(Set dst (RShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9558
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9559
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9560
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9561
    uimmI6 mask %{ 0x3a /* clear 58 bits, keep 6 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9562
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9563
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9564
    arShiftL_regL_regI(dst, src1, tmpI);
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
%}
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
// Register Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9569
instruct arShiftL_regL_immI(iRegLdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9570
  match(Set dst (RShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9571
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9572
  format %{ "SRADI   $dst, $src1, ($src2 & 0x3f)" %}
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_sradi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9576
    __ sradi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9581
// RShiftL + ConvL2I
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9582
instruct convL2I_arShiftL_regL_immI(iRegIdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9583
  match(Set dst (ConvL2I (RShiftL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9584
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9585
  format %{ "SRADI   $dst, $src1, ($src2 & 0x3f) \t// long + l2i" %}
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_sradi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9589
    __ sradi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
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
instruct urShiftI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9595
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9596
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9597
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9598
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9599
  format %{ "SRW     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9600
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9601
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9602
    // TODO: PPC port $archOpcode(ppc64Opcode_srw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9603
    __ srw($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9604
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9605
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9606
%}
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
// Register Shift Right
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9609
instruct urShiftI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9610
  match(Set dst (URShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9611
  ins_cost(DEFAULT_COST*2);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9614
    uimmI6 mask %{ 0x3b /* clear 59 bits, keep 5 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9615
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9616
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9617
    urShiftI_reg_reg(dst, src1, tmpI);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9621
// Register Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9622
instruct urShiftI_reg_imm(iRegIdst dst, iRegIsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9623
  match(Set dst (URShiftI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9624
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9625
  format %{ "SRWI    $dst, $src1, ($src2 & 0x1f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9626
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9627
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9628
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9629
    __ srwi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9630
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9631
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9632
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9633
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9634
instruct urShiftL_regL_regI(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9635
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9636
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9637
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9638
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9639
  format %{ "SRD     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9640
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9641
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9642
    // TODO: PPC port $archOpcode(ppc64Opcode_srd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9643
    __ srd($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9644
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9645
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9646
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9647
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9648
// Register Shift Right
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9649
instruct urShiftL_regL_regI_Ex(iRegLdst dst, iRegLsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9650
  match(Set dst (URShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9651
  ins_cost(DEFAULT_COST*2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9652
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9653
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9654
    uimmI6 mask %{ 0x3a /* clear 58 bits, keep 6 */ %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9655
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9656
    maskI_reg_imm(tmpI, src2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9657
    urShiftL_regL_regI(dst, src1, tmpI);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9658
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9659
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9660
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9661
// Register Shift Right Immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9662
instruct urShiftL_regL_immI(iRegLdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9663
  match(Set dst (URShiftL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9664
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9665
  format %{ "SRDI    $dst, $src1, ($src2 & 0x3f)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9666
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9667
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9668
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9669
    __ srdi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9670
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9671
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9672
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9673
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9674
// URShiftL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9675
instruct convL2I_urShiftL_regL_immI(iRegIdst dst, iRegLsrc src1, immI src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9676
  match(Set dst (ConvL2I (URShiftL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9677
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9678
  format %{ "SRDI    $dst, $src1, ($src2 & 0x3f) \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9679
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9680
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9681
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9682
    __ srdi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9683
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9684
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9685
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9686
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9687
// Register Shift Right Immediate with a CastP2X
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9688
instruct shrP_convP2X_reg_imm6(iRegLdst dst, iRegP_N2P src1, uimmI6 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9689
  match(Set dst (URShiftL (CastP2X src1) src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9690
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9691
  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
  9692
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9693
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9694
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9695
    __ srdi($dst$$Register, $src1$$Register, ($src2$$constant) & 0x3f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9696
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9697
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9698
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9699
46555
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9700
// Bitfield Extract: URShiftI + AndI
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9701
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
  9702
  match(Set dst (AndI (URShiftI src1 src2) src3));
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9703
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9704
  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
  9705
  size(4);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9706
  ins_encode %{
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9707
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9708
    int rshift = ($src2$$constant) & 0x1f;
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9709
    int length = log2_long(((jlong) $src3$$constant) + 1);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9710
    if (rshift + length > 32) {
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9711
      // if necessary, adjust mask to omit rotated bits.
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9712
      length = 32 - rshift;
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9713
    }
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9714
    __ extrdi($dst$$Register, $src1$$Register, length, 64 - (rshift + length));
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9715
  %}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9716
  ins_pipe(pipe_class_default);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9717
%}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9718
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9719
// Bitfield Extract: URShiftL + AndL
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9720
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
  9721
  match(Set dst (AndL (URShiftL src1 src2) src3));
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9722
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9723
  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
  9724
  size(4);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9725
  ins_encode %{
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9726
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9727
    int rshift  = ($src2$$constant) & 0x3f;
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9728
    int length = log2_long(((jlong) $src3$$constant) + 1);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9729
    if (rshift + length > 64) {
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9730
      // if necessary, adjust mask to omit rotated bits.
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9731
      length = 64 - rshift;
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9732
    }
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9733
    __ extrdi($dst$$Register, $src1$$Register, length, 64 - (rshift + length));
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9734
  %}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9735
  ins_pipe(pipe_class_default);
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9736
%}
5ada291c5063 8181810: PPC64: Leverage extrdi for bitfield extract
mdoerr
parents: 46521
diff changeset
  9737
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9738
instruct sxtI_reg(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9739
  match(Set dst (ConvL2I (ConvI2L src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9740
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9741
  format %{ "EXTSW   $dst, $src \t// int->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9742
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9743
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9744
    // TODO: PPC port $archOpcode(ppc64Opcode_extsw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9745
    __ extsw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9746
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9747
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9748
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9749
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9750
//----------Rotate Instructions------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9751
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9752
// Rotate Left by 8-bit immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9753
instruct rotlI_reg_immi8(iRegIdst dst, iRegIsrc src, immI8 lshift, immI8 rshift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9754
  match(Set dst (OrI (LShiftI src lshift) (URShiftI src rshift)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9755
  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
  9756
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9757
  format %{ "ROTLWI  $dst, $src, $lshift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9758
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9759
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9760
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9761
    __ rotlwi($dst$$Register, $src$$Register, $lshift$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9762
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9763
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9764
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9765
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9766
// Rotate Right by 8-bit immediate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9767
instruct rotrI_reg_immi8(iRegIdst dst, iRegIsrc src, immI8 rshift, immI8 lshift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9768
  match(Set dst (OrI (URShiftI src rshift) (LShiftI src lshift)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9769
  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
  9770
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9771
  format %{ "ROTRWI  $dst, $rshift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9772
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9773
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9774
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9775
    __ rotrwi($dst$$Register, $src$$Register, $rshift$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9776
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9777
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9778
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9779
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9780
//----------Floating Point Arithmetic Instructions-----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9781
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9782
// Add float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9783
instruct addF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9784
  match(Set dst (AddF src1 src2));
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
  format %{ "FADDS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9787
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9788
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9789
    // TODO: PPC port $archOpcode(ppc64Opcode_fadds);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9790
    __ fadds($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9791
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9792
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9793
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9794
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9795
// Add float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9796
instruct addD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9797
  match(Set dst (AddD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9798
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9799
  format %{ "FADD    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9800
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9801
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9802
    // TODO: PPC port $archOpcode(ppc64Opcode_fadd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9803
    __ fadd($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9804
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9805
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9806
%}
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
// Sub float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9809
instruct subF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9810
  match(Set dst (SubF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9811
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9812
  format %{ "FSUBS   $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_fsubs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9816
    __ fsubs($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9817
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9818
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9819
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9820
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9821
// Sub float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9822
instruct subD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9823
  match(Set dst (SubD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9824
  format %{ "FSUB    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9825
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9826
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9827
    // TODO: PPC port $archOpcode(ppc64Opcode_fsub);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9828
    __ fsub($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9829
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9830
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9831
%}
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
// Mul float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9834
instruct mulF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9835
  match(Set dst (MulF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9836
  format %{ "FMULS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9837
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9838
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9839
    // TODO: PPC port $archOpcode(ppc64Opcode_fmuls);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9840
    __ fmuls($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9841
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9842
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9843
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9844
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9845
// Mul float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9846
instruct mulD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9847
  match(Set dst (MulD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9848
  format %{ "FMUL    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9849
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9850
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9851
    // TODO: PPC port $archOpcode(ppc64Opcode_fmul);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9852
    __ fmul($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9853
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9854
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9855
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9856
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9857
// Div float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9858
instruct divF_reg_reg(regF dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9859
  match(Set dst (DivF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9860
  format %{ "FDIVS   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9861
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9862
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9863
    // TODO: PPC port $archOpcode(ppc64Opcode_fdivs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9864
    __ fdivs($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9865
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9866
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9867
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9868
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9869
// Div float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9870
instruct divD_reg_reg(regD dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9871
  match(Set dst (DivD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9872
  format %{ "FDIV    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9873
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9874
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9875
    // TODO: PPC port $archOpcode(ppc64Opcode_fdiv);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9876
    __ fdiv($dst$$FloatRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9877
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9878
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9879
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9880
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9881
// Absolute float single precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9882
instruct absF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9883
  match(Set dst (AbsF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9884
  format %{ "FABS    $dst, $src \t// float" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9885
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9886
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9887
    // TODO: PPC port $archOpcode(ppc64Opcode_fabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9888
    __ fabs($dst$$FloatRegister, $src$$FloatRegister);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9891
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9892
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9893
// Absolute float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9894
instruct absD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9895
  match(Set dst (AbsD src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9896
  format %{ "FABS    $dst, $src \t// double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9897
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9898
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9899
    // TODO: PPC port $archOpcode(ppc64Opcode_fabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9900
    __ fabs($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9901
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9902
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9903
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9904
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9905
instruct negF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9906
  match(Set dst (NegF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9907
  format %{ "FNEG    $dst, $src \t// float" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9908
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9909
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9910
    // TODO: PPC port $archOpcode(ppc64Opcode_fneg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9911
    __ fneg($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9912
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9913
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9916
instruct negD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9917
  match(Set dst (NegD src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9918
  format %{ "FNEG    $dst, $src \t// double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9919
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9920
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9921
    // TODO: PPC port $archOpcode(ppc64Opcode_fneg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9922
    __ fneg($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9923
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9924
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9925
%}
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
// AbsF + NegF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9928
instruct negF_absF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9929
  match(Set dst (NegF (AbsF src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9930
  format %{ "FNABS   $dst, $src \t// float" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9931
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9932
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9933
    // TODO: PPC port $archOpcode(ppc64Opcode_fnabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9934
    __ fnabs($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9935
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9936
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9939
// AbsD + NegD.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9940
instruct negD_absD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9941
  match(Set dst (NegD (AbsD src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9942
  format %{ "FNABS   $dst, $src \t// double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9943
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9944
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9945
    // TODO: PPC port $archOpcode(ppc64Opcode_fnabs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9946
    __ fnabs($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9947
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9948
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9949
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9950
22879
177361c49b26 8035394: PPC64: Make usage of intrinsic dsqrt depend on processor recognition.
goetz
parents: 22874
diff changeset
  9951
// VM_Version::has_fsqrt() decides if this node will be used.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9952
// Sqrt float double precision
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9953
instruct sqrtD_reg(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9954
  match(Set dst (SqrtD src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9955
  format %{ "FSQRT   $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9956
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9957
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9958
    // TODO: PPC port $archOpcode(ppc64Opcode_fsqrt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9959
    __ fsqrt($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9960
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9961
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9962
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9963
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9964
// Single-precision sqrt.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9965
instruct sqrtF_reg(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9966
  match(Set dst (ConvD2F (SqrtD (ConvF2D src))));
23492
af5352f40e65 8037915: PPC64/AIX: Several smaller fixes
goetz
parents: 23211
diff changeset
  9967
  predicate(VM_Version::has_fsqrts());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9968
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9969
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9970
  format %{ "FSQRTS  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9971
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9972
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9973
    // TODO: PPC port $archOpcode(ppc64Opcode_fsqrts);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9974
    __ fsqrts($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9975
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9976
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9977
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9978
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9979
instruct roundDouble_nop(regD dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9980
  match(Set dst (RoundDouble dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9981
  ins_cost(0);
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
  format %{ " -- \t// RoundDouble not needed - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9984
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9985
  // PPC results are already "rounded" (i.e., normal-format IEEE).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9986
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9987
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9988
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9989
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9990
instruct roundFloat_nop(regF dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9991
  match(Set dst (RoundFloat dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9992
  ins_cost(0);
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
  format %{ " -- \t// RoundFloat not needed - empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9995
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9996
  // PPC results are already "rounded" (i.e., normal-format IEEE).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9997
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9998
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
  9999
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10000
42884
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10001
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10002
// Multiply-Accumulate
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10003
// src1 * src2 + src3
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10004
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
 10005
  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
 10006
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10007
  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
 10008
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10009
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10010
    // 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
 10011
    __ 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
 10012
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10013
  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
 10014
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10015
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10016
// src1 * src2 + src3
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10017
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
 10018
  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
 10019
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10020
  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
 10021
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10022
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10023
    // 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
 10024
    __ 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
 10025
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10026
  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
 10027
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10028
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10029
// -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
 10030
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
 10031
  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
 10032
  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
 10033
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10034
  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
 10035
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10036
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10037
    // 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
 10038
    __ 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
 10039
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10040
  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
 10041
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10042
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10043
// -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
 10044
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
 10045
  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
 10046
  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
 10047
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10048
  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
 10049
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10050
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10051
    // 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
 10052
    __ 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
 10053
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10054
  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
 10055
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10056
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10057
// -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
 10058
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
 10059
  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
 10060
  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
 10061
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10062
  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
 10063
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10064
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10065
    // 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
 10066
    __ 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
 10067
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10068
  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
 10069
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10070
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10071
// -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
 10072
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
 10073
  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
 10074
  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
 10075
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10076
  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
 10077
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10078
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10079
    // 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
 10080
    __ 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
 10081
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10082
  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
 10083
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10084
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10085
// src1 * src2 - src3
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10086
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
 10087
  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
 10088
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10089
  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
 10090
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10091
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10092
    // 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
 10093
    __ 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
 10094
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10095
  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
 10096
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10097
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10098
// src1 * src2 - src3
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10099
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
 10100
  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
 10101
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10102
  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
 10103
  size(4);
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10104
  ins_encode %{
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10105
    // 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
 10106
    __ 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
 10107
  %}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10108
  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
 10109
%}
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10110
05815125c157 8171244: PPC64: Make interpreter's math entries consistent with C1 and C2 and support FMA
mdoerr
parents: 42661
diff changeset
 10111
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10112
//----------Logical Instructions-----------------------------------------------
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
// And Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10115
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10116
// Register And
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10117
instruct andI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10118
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10119
  format %{ "AND     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10120
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10121
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10122
    // TODO: PPC port $archOpcode(ppc64Opcode_and);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10123
    __ andr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10124
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10125
  ins_pipe(pipe_class_default);
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
42619
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10128
// Left shifted Immediate And
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10129
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
 10130
  match(Set dst (AndI src1 src2));
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10131
  effect(KILL cr0);
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10132
  format %{ "ANDIS   $dst, $src1, $src2.hi" %}
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10133
  size(4);
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10134
  ins_encode %{
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10135
    // TODO: PPC port $archOpcode(ppc64Opcode_andis_);
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10136
    __ 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
 10137
  %}
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10138
  ins_pipe(pipe_class_default);
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10139
%}
681817cc043f 8170328: PPC64: Use andis instead of lis/and
mdoerr
parents: 42072
diff changeset
 10140
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10141
// Immediate And
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10142
instruct andI_reg_uimm16(iRegIdst dst, iRegIsrc src1, uimmI16 src2, flagsRegCR0 cr0) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10143
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10144
  effect(KILL cr0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10145
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10146
  format %{ "ANDI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10147
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10148
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10149
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10150
    // FIXME: avoid andi_ ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10151
    __ andi_($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10152
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10153
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10154
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10155
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10156
// Immediate And where the immediate is a negative power of 2.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10157
instruct andI_reg_immInegpow2(iRegIdst dst, iRegIsrc src1, immInegpow2 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10158
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10159
  format %{ "ANDWI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10160
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10161
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10162
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10163
    __ clrrdi($dst$$Register, $src1$$Register, log2_long((jlong)(julong)(juint)-($src2$$constant)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10164
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10165
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10166
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10167
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10168
instruct andI_reg_immIpow2minus1(iRegIdst dst, iRegIsrc src1, immIpow2minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10169
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10170
  format %{ "ANDWI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10171
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10172
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10173
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10174
    __ clrldi($dst$$Register, $src1$$Register, 64-log2_long((((jlong) $src2$$constant)+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10175
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10176
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10177
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10178
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10179
instruct andI_reg_immIpowerOf2(iRegIdst dst, iRegIsrc src1, immIpowerOf2 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10180
  match(Set dst (AndI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10181
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10182
  format %{ "ANDWI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10183
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10184
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10185
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10186
    __ rlwinm($dst$$Register, $src1$$Register, 0,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10187
              (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
 10188
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10189
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10192
// Register And Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10193
instruct andL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10194
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10195
  ins_cost(DEFAULT_COST);
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
  format %{ "AND     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10198
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10199
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10200
    // TODO: PPC port $archOpcode(ppc64Opcode_and);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10201
    __ andr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10202
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10203
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10204
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10205
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10206
// Immediate And long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10207
instruct andL_reg_uimm16(iRegLdst dst, iRegLsrc src1, uimmL16 src2, flagsRegCR0 cr0) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10208
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10209
  effect(KILL cr0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10210
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10211
  format %{ "ANDI    $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10212
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10213
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10214
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10215
    // FIXME: avoid andi_ ?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10216
    __ andi_($dst$$Register, $src1$$Register, $src2$$constant);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10219
%}
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
// Immediate And Long where the immediate is a negative power of 2.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10222
instruct andL_reg_immLnegpow2(iRegLdst dst, iRegLsrc src1, immLnegpow2 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10223
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10224
  format %{ "ANDDI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10225
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10226
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10227
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10228
    __ clrrdi($dst$$Register, $src1$$Register, log2_long((jlong)-$src2$$constant));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10229
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10230
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10233
instruct andL_reg_immLpow2minus1(iRegLdst dst, iRegLsrc src1, immLpow2minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10234
  match(Set dst (AndL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10235
  format %{ "ANDDI   $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10236
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10237
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10238
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10239
    __ clrldi($dst$$Register, $src1$$Register, 64-log2_long((((jlong) $src2$$constant)+1)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10240
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10241
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10244
// AndL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10245
instruct convL2I_andL_reg_immLpow2minus1(iRegIdst dst, iRegLsrc src1, immLpow2minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10246
  match(Set dst (ConvL2I (AndL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10247
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10248
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10249
  format %{ "ANDDI   $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10250
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10251
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10252
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10253
    __ clrldi($dst$$Register, $src1$$Register, 64-log2_long((((jlong) $src2$$constant)+1)));
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_default);
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
// Or Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10259
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10260
// Register Or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10261
instruct orI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10262
  match(Set dst (OrI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10263
  format %{ "OR      $dst, $src1, $src2" %}
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 %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10266
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10267
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10272
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10273
instruct orI_reg_reg_2(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10274
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10275
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10276
  format %{ "OR      $dst, $src1, $src2" %}
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 %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10279
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10280
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10285
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
 10286
  match(Set dst (OrI (OrI (OrI src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10287
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10288
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10289
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10290
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10291
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10292
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10293
    orI_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10294
    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
 10295
    orI_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10296
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10297
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10298
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10299
// Immediate Or
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10300
instruct orI_reg_uimm16(iRegIdst dst, iRegIsrc src1, uimmI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10301
  match(Set dst (OrI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10302
  format %{ "ORI     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10303
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10304
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10305
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10306
    __ ori($dst$$Register, $src1$$Register, ($src2$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10307
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10308
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10309
%}
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
// Register Or Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10312
instruct orL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10313
  match(Set dst (OrL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10314
  ins_cost(DEFAULT_COST);
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
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10317
  format %{ "OR      $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10318
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10319
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10320
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10323
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10324
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10325
// OrL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10326
instruct orI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10327
  match(Set dst (ConvL2I (OrL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10328
  ins_cost(DEFAULT_COST);
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
  format %{ "OR      $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10331
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10332
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10333
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10334
    __ or_unchecked($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10337
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10338
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10339
// Immediate Or long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10340
instruct orL_reg_uimm16(iRegLdst dst, iRegLsrc src1, uimmL16 con) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10341
  match(Set dst (OrL src1 con));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10342
  ins_cost(DEFAULT_COST);
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
  format %{ "ORI     $dst, $src1, $con \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10345
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10346
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10347
    // TODO: PPC port $archOpcode(ppc64Opcode_ori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10348
    __ ori($dst$$Register, $src1$$Register, ($con$$constant) & 0xFFFF);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10349
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10350
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10351
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10352
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10353
// Xor Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10354
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10355
// Register Xor
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10356
instruct xorI_reg_reg(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10357
  match(Set dst (XorI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10358
  format %{ "XOR     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10359
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10360
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10361
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10362
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10365
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10366
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10367
// Expand does not work with above instruct. (??)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10368
instruct xorI_reg_reg_2(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10369
  // no match-rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10370
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10371
  format %{ "XOR     $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10372
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10373
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10374
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10375
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10376
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10377
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10378
%}
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
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
 10381
  match(Set dst (XorI (XorI (XorI src1 src2) src3) src4));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10382
  ins_cost(DEFAULT_COST*3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10383
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10384
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10385
    // FIXME: we should do this in the ideal world.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10386
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10387
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10388
    xorI_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10389
    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
 10390
    xorI_reg_reg(dst, tmp1, tmp2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10391
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10392
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10393
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10394
// Immediate Xor
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10395
instruct xorI_reg_uimm16(iRegIdst dst, iRegIsrc src1, uimmI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10396
  match(Set dst (XorI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10397
  format %{ "XORI    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10398
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10399
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10400
    // TODO: PPC port $archOpcode(ppc64Opcode_xori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10401
    __ xori($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10402
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10403
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10404
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10405
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10406
// Register Xor Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10407
instruct xorL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10408
  match(Set dst (XorL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10409
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10410
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10411
  format %{ "XOR     $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10412
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10413
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10414
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10415
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10416
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10417
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10418
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10419
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10420
// XorL + ConvL2I.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10421
instruct xorI_regL_regL(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10422
  match(Set dst (ConvL2I (XorL src1 src2)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10423
  ins_cost(DEFAULT_COST);
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
  format %{ "XOR     $dst, $src1, $src2 \t// long + l2i" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10426
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10427
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10428
    // TODO: PPC port $archOpcode(ppc64Opcode_xor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10429
    __ xorr($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10430
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10431
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10434
// Immediate Xor Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10435
instruct xorL_reg_uimm16(iRegLdst dst, iRegLsrc src1, uimmL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10436
  match(Set dst (XorL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10437
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10438
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10439
  format %{ "XORI    $dst, $src1, $src2 \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10440
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10441
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10442
    // TODO: PPC port $archOpcode(ppc64Opcode_xori);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10443
    __ xori($dst$$Register, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10444
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10445
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10446
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10447
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10448
instruct notI_reg(iRegIdst dst, iRegIsrc src1, immI_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10449
  match(Set dst (XorI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10450
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10451
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10452
  format %{ "NOT     $dst, $src1 ($src2)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10453
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10454
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10455
    // TODO: PPC port $archOpcode(ppc64Opcode_nor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10456
    __ nor($dst$$Register, $src1$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10457
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10458
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10459
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10460
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10461
instruct notL_reg(iRegLdst dst, iRegLsrc src1, immL_minus1 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10462
  match(Set dst (XorL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10463
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10464
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10465
  format %{ "NOT     $dst, $src1 ($src2) \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10466
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10467
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10468
    // TODO: PPC port $archOpcode(ppc64Opcode_nor);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10469
    __ nor($dst$$Register, $src1$$Register, $src1$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10470
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10471
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10474
// And-complement
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10475
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
 10476
  match(Set dst (AndI (XorI src1 src2) src3));
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 %{ "ANDW    $dst, xori($src1, $src2), $src3" %}
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( enc_andc(dst, src3, src1) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10482
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10483
%}
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
// And-complement
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10486
instruct andcL_reg_reg(iRegLdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10487
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10488
  effect(DEF dst, USE src1, USE src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10489
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10490
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10491
  format %{ "ANDC    $dst, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10492
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10493
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10494
    // TODO: PPC port $archOpcode(ppc64Opcode_andc);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10495
    __ andc($dst$$Register, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10496
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10497
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10500
//----------Moves between int/long and float/double----------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10501
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10502
// The following rules move values from int/long registers/stack-locations
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10503
// to float/double registers/stack-locations and vice versa, without doing any
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10504
// conversions. These rules are used to implement the bit-conversion methods
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10505
// of java.lang.Float etc., e.g.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10506
//   int   floatToIntBits(float value)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10507
//   float intBitsToFloat(int bits)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10508
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10509
// Notes on the implementation on ppc64:
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10510
// 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
 10511
// 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
 10512
// when moving between a float register and an integer register.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10513
// 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
 10514
// and mffprd instructions.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10515
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10516
instruct moveL2D_reg(regD dst, iRegLsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10517
  match(Set dst (MoveL2D src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10518
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10519
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10520
  format %{ "MTFPRD  $dst, $src" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10521
  size(4);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10522
  ins_encode %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10523
    __ mtfprd($dst$$FloatRegister, $src$$Register);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10524
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10525
  ins_pipe(pipe_class_default);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10526
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10527
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10528
instruct moveI2D_reg(regD dst, iRegIsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10529
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10530
  effect(DEF dst, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10531
  predicate(false);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10532
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10533
  format %{ "MTFPRWA $dst, $src" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10534
  size(4);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10535
  ins_encode %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10536
    __ mtfprwa($dst$$FloatRegister, $src$$Register);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10537
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10538
  ins_pipe(pipe_class_default);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 10539
%}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10540
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10541
//---------- Chain stack slots between similar types --------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10542
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10543
// These are needed so that the rules below can match.
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
// Load integer from stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10546
instruct stkI_to_regI(iRegIdst dst, stackSlotI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10547
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10548
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10549
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10550
  format %{ "LWZ     $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10551
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10552
  ins_encode( enc_lwz(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10553
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10554
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10555
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10556
// Store integer to stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10557
instruct regI_to_stkI(stackSlotI dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10558
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10559
  ins_cost(MEMORY_REF_COST);
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
  format %{ "STW     $src, $dst \t// stk" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10562
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10563
  ins_encode( enc_stw(src, dst) ); // rs=rt
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10564
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10565
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10567
// Load long from stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10568
instruct stkL_to_regL(iRegLdst dst, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10569
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10570
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10571
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10572
  format %{ "LD      $dst, $src \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10573
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10574
  ins_encode( enc_ld(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10575
  ins_pipe(pipe_class_memory);
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
// Store long to stack slot
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10579
instruct regL_to_stkL(stackSlotL dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10580
  match(Set dst src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10581
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10582
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10583
  format %{ "STD     $src, $dst \t// long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10584
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10585
  ins_encode( enc_std(src, dst) ); // rs=rt
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10586
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10587
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10588
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10589
//----------Moves between int and float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10590
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10591
// Move float value from float stack-location to integer register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10592
instruct moveF2I_stack_reg(iRegIdst dst, stackSlotF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10593
  match(Set dst (MoveF2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10594
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10595
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10596
  format %{ "LWZ     $dst, $src \t// MoveF2I" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10597
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10598
  ins_encode( enc_lwz(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10599
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10600
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10601
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10602
// Move float value from float register to integer stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10603
instruct moveF2I_reg_stack(stackSlotI dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10604
  match(Set dst (MoveF2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10605
  ins_cost(MEMORY_REF_COST);
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
  format %{ "STFS    $src, $dst \t// MoveF2I" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10608
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10609
  ins_encode( enc_stfs(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10610
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10611
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10612
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10613
// Move integer value from integer stack-location to float register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10614
instruct moveI2F_stack_reg(regF dst, stackSlotI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10615
  match(Set dst (MoveI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10616
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10617
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10618
  format %{ "LFS     $dst, $src \t// MoveI2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10619
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10620
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10621
    // TODO: PPC port $archOpcode(ppc64Opcode_lfs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10622
    int Idisp = $src$$disp + frame_slots_bias($src$$base, ra_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10623
    __ lfs($dst$$FloatRegister, Idisp, $src$$base$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10624
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10625
  ins_pipe(pipe_class_memory);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10628
// Move integer value from integer register to float stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10629
instruct moveI2F_reg_stack(stackSlotF dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10630
  match(Set dst (MoveI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10631
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10632
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10633
  format %{ "STW     $src, $dst \t// MoveI2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10634
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10635
  ins_encode( enc_stw(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10636
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10637
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10638
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10639
//----------Moves between long and float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10640
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10641
instruct moveF2L_reg_stack(stackSlotL dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10642
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10643
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10644
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10645
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10646
  format %{ "storeD  $src, $dst \t// STACK" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10647
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10648
  ins_encode( enc_stfd(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10649
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10652
//----------Moves between long and double
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
// Move double value from double stack-location to long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10655
instruct moveD2L_stack_reg(iRegLdst dst, stackSlotD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10656
  match(Set dst (MoveD2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10657
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10658
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10659
  format %{ "LD      $dst, $src \t// MoveD2L" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10660
  ins_encode( enc_ld(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10661
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10662
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10663
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10664
// Move double value from double register to long stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10665
instruct moveD2L_reg_stack(stackSlotL dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10666
  match(Set dst (MoveD2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10667
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10668
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10669
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10670
  format %{ "STFD    $src, $dst \t// MoveD2L" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10671
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10672
  ins_encode( enc_stfd(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10673
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10674
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10675
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10676
// Move long value from long stack-location to double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10677
instruct moveL2D_stack_reg(regD dst, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10678
  match(Set dst (MoveL2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10679
  ins_cost(MEMORY_REF_COST);
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
  format %{ "LFD     $dst, $src \t// MoveL2D" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10682
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10683
  ins_encode( enc_lfd(dst, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10684
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10685
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10686
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10687
// Move long value from long register to double stack-location.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10688
instruct moveL2D_reg_stack(stackSlotD dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10689
  match(Set dst (MoveL2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10690
  ins_cost(MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10691
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10692
  format %{ "STD     $src, $dst \t// MoveL2D" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10693
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10694
  ins_encode( enc_std(src, dst) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10695
  ins_pipe(pipe_class_memory);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10696
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10697
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10698
//----------Register Move Instructions-----------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10699
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10700
// Replicate for Superword
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10701
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10702
instruct moveReg(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10703
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10704
  effect(DEF dst, USE src);
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
  format %{ "MR      $dst, $src \t// replicate " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10707
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10708
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10709
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10710
    __ mr_if_needed($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10715
//----------Cast instructions (Java-level type cast)---------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10716
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10717
// Cast Long to Pointer for unsafe natives.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10718
instruct castX2P(iRegPdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10719
  match(Set dst (CastX2P src));
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
  format %{ "MR      $dst, $src \t// Long->Ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10722
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10723
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10724
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10725
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10726
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10727
 ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10730
// Cast Pointer to Long for unsafe natives.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10731
instruct castP2X(iRegLdst dst, iRegP_N2P src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10732
  match(Set dst (CastP2X src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10733
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10734
  format %{ "MR      $dst, $src \t// Ptr->Long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10735
  // variable size, 0 or 4.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10736
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10737
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10738
    __ mr_if_needed($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10741
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10742
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10743
instruct castPP(iRegPdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10744
  match(Set dst (CastPP dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10745
  format %{ " -- \t// castPP of $dst" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10746
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10747
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10748
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10749
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10750
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10751
instruct castII(iRegIdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10752
  match(Set dst (CastII dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10753
  format %{ " -- \t// castII of $dst" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10754
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10755
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10756
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10757
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10758
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10759
instruct checkCastPP(iRegPdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10760
  match(Set dst (CheckCastPP dst));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10761
  format %{ " -- \t// checkcastPP of $dst" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10762
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10763
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10764
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10765
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10766
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10767
//----------Convert instructions-----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10768
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10769
// Convert to boolean.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10770
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10771
// int_to_bool(src) : { 1   if src != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10772
//                    { 0   else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10773
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10774
// strategy:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10775
// 1) Count leading zeros of 32 bit-value src,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10776
//    this returns 32 (0b10.0000) iff src == 0 and <32 otherwise.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10777
// 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
 10778
// 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
 10779
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10780
// convI2Bool
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10781
instruct convI2Bool_reg__cntlz_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10782
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10783
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10784
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10785
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10786
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10787
    immI shiftAmount %{ 0x5 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10788
    uimmI16 mask %{ 0x1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10789
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10790
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10791
    countLeadingZerosI(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10792
    urShiftI_reg_imm(tmp2, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10793
    xorI_reg_uimm16(dst, tmp2, mask);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10794
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10795
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10796
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10797
instruct convI2Bool_reg__cmove(iRegIdst dst, iRegIsrc src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10798
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10799
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10800
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10801
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10802
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10803
  format %{ "CMPWI   $crx, $src, #0 \t// convI2B"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10804
            "LI      $dst, #0\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10805
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10806
            "LI      $dst, #1\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10807
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10808
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10809
  ins_encode( enc_convI2B_regI__cmove(dst, src, crx, 0x0, 0x1) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10810
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10811
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10812
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10813
// ConvI2B + XorI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10814
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
 10815
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10816
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10817
  ins_cost(DEFAULT_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10820
    immI shiftAmount %{ 0x5 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10821
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10822
    countLeadingZerosI(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10823
    urShiftI_reg_imm(dst, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10824
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10825
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10826
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10827
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
 10828
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10829
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10830
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10831
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10832
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10833
  format %{ "CMPWI   $crx, $src, #0 \t// Xor(convI2B($src), $mask)"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10834
            "LI      $dst, #1\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10835
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10836
            "LI      $dst, #0\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10837
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10838
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10839
  ins_encode( enc_convI2B_regI__cmove(dst, src, crx, 0x1, 0x0) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10840
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10841
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10842
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10843
// AndI 0b0..010..0 + ConvI2B
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10844
instruct convI2Bool_andI_reg_immIpowerOf2(iRegIdst dst, iRegIsrc src, immIpowerOf2 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10845
  match(Set dst (Conv2B (AndI src mask)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10846
  predicate(UseRotateAndMaskInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10847
  ins_cost(DEFAULT_COST);
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
  format %{ "RLWINM  $dst, $src, $mask \t// convI2B(AndI($src, $mask))" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10850
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10851
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10852
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10853
    __ 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
 10854
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10855
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10856
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10857
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10858
// Convert pointer to boolean.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10859
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10860
// ptr_to_bool(src) : { 1   if src != 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10861
//                    { 0   else
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10862
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10863
// strategy:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10864
// 1) Count leading zeros of 64 bit-value src,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10865
//    this returns 64 (0b100.0000) iff src == 0 and <64 otherwise.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10866
// 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
 10867
// 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
 10868
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10869
// ConvP2B
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10870
instruct convP2Bool_reg__cntlz_Ex(iRegIdst dst, iRegP_N2P src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10871
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10872
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10873
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10874
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10875
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10876
    immI shiftAmount %{ 0x6 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10877
    uimmI16 mask %{ 0x1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10878
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10879
    iRegIdst tmp2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10880
    countLeadingZerosP(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10881
    urShiftI_reg_imm(tmp2, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10882
    xorI_reg_uimm16(dst, tmp2, mask);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10885
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10886
instruct convP2Bool_reg__cmove(iRegIdst dst, iRegP_N2P src, flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10887
  match(Set dst (Conv2B src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10888
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10889
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10890
  ins_cost(DEFAULT_COST);
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
  format %{ "CMPDI   $crx, $src, #0 \t// convP2B"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10893
            "LI      $dst, #0\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10894
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10895
            "LI      $dst, #1\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10896
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10897
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10898
  ins_encode( enc_convP2B_regP__cmove(dst, src, crx, 0x0, 0x1) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10899
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10900
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10901
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10902
// ConvP2B + XorI
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10903
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
 10904
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10905
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10906
  ins_cost(DEFAULT_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10909
    immI shiftAmount %{ 0x6 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10910
    iRegIdst tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10911
    countLeadingZerosP(tmp1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10912
    urShiftI_reg_imm(dst, tmp1, shiftAmount);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10913
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10914
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10915
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10916
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
 10917
  match(Set dst (XorI (Conv2B src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10918
  effect(TEMP crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10919
  predicate(!UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10920
  ins_cost(DEFAULT_COST);
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
  format %{ "CMPDI   $crx, $src, #0 \t// XorI(convP2B($src), $mask)"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10923
            "LI      $dst, #1\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10924
            "BEQ     $crx, done\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10925
            "LI      $dst, #0\n"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10926
            "done:" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10927
  size(16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10928
  ins_encode( enc_convP2B_regP__cmove(dst, src, crx, 0x1, 0x0) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10929
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10930
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10931
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10932
// if src1 < src2, return -1 else return 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10933
instruct cmpLTMask_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10934
  match(Set dst (CmpLTMask src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10935
  ins_cost(DEFAULT_COST*4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10936
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10937
  expand %{
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10938
    iRegLdst src1s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10939
    iRegLdst src2s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10940
    iRegLdst diff;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10941
    convI2L_reg(src1s, src1); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10942
    convI2L_reg(src2s, src2); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10943
    subL_reg_reg(diff, src1s, src2s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10944
    // Need to consider >=33 bit result, therefore we need signmaskL.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 10945
    signmask64I_regL(dst, diff);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10946
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10947
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10948
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10949
instruct cmpLTMask_reg_immI0(iRegIdst dst, iRegIsrc src1, immI_0 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10950
  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
 10951
  format %{ "SRAWI   $dst, $src1, $src2 \t// CmpLTMask" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10952
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10953
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10954
    // TODO: PPC port $archOpcode(ppc64Opcode_srawi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10955
    __ srawi($dst$$Register, $src1$$Register, 0x1f);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10956
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10957
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10958
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10959
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10960
//----------Arithmetic Conversion Instructions---------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10961
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10962
// Convert to Byte  -- nop
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10963
// Convert to Short -- nop
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10964
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10965
// Convert to Int
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10966
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10967
instruct convB2I_reg(iRegIdst dst, iRegIsrc src, immI_24 amount) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10968
  match(Set dst (RShiftI (LShiftI src amount) amount));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10969
  format %{ "EXTSB   $dst, $src \t// byte->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10970
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10971
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10972
    // TODO: PPC port $archOpcode(ppc64Opcode_extsb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10973
    __ extsb($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
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
46521
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10978
instruct extsh(iRegIdst dst, iRegIsrc src) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10979
  effect(DEF dst, USE src);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10980
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10981
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10982
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10983
    __ extsh($dst$$Register, $src$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10984
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10985
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10986
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 10987
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10988
// LShiftI 16 + RShiftI 16 converts short to int.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10989
instruct convS2I_reg(iRegIdst dst, iRegIsrc src, immI_16 amount) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10990
  match(Set dst (RShiftI (LShiftI src amount) amount));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10991
  format %{ "EXTSH   $dst, $src \t// short->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10992
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10993
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10994
    // TODO: PPC port $archOpcode(ppc64Opcode_extsh);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10995
    __ extsh($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10996
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 10997
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11000
// ConvL2I + ConvI2L: Sign extend int in long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11001
instruct sxtI_L2L_reg(iRegLdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11002
  match(Set dst (ConvI2L (ConvL2I src)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11003
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11004
  format %{ "EXTSW   $dst, $src \t// long->long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11005
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11006
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11007
    // TODO: PPC port $archOpcode(ppc64Opcode_extsw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11008
    __ extsw($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11011
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11012
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11013
instruct convL2I_reg(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11014
  match(Set dst (ConvL2I src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11015
  format %{ "MR      $dst, $src \t// long->int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11016
  // variable size, 0 or 4
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11017
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11018
    // TODO: PPC port $archOpcode(ppc64Opcode_or);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11019
    __ mr_if_needed($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11020
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11021
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11022
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11023
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11024
instruct convD2IRaw_regD(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11025
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11026
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11027
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11028
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11029
  format %{ "FCTIWZ $dst, $src \t// convD2I, $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11030
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11031
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11032
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11033
    __ fctiwz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11034
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11035
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11036
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11037
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11038
instruct cmovI_bso_stackSlotL(iRegIdst dst, flagsRegSrc crx, stackSlotL src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11039
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11040
  effect(DEF dst, USE crx, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11041
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11042
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11043
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11044
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11045
  format %{ "cmovI   $crx, $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11046
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11047
  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
 11048
  ins_encode( enc_cmove_bso_stackSlotL(dst, crx, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11049
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11050
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11051
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11052
instruct cmovI_bso_reg(iRegIdst dst, flagsRegSrc crx, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11053
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11054
  effect(DEF dst, USE crx, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11055
  predicate(false);
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
  ins_variable_size_depending_on_alignment(true);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11058
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11059
  format %{ "cmovI   $crx, $dst, $src" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11060
  // Worst case is branch + move + stop, no stop without scheduler.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11061
  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
 11062
  ins_encode( enc_cmove_bso_reg(dst, crx, src) );
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11063
  ins_pipe(pipe_class_default);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11066
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
 11067
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11068
  effect(DEF dst, USE crx, USE mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11069
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11070
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11071
  format %{ "CmovI   $dst, $crx, $mem \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11072
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11073
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11074
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11075
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11076
    //   region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11077
    //    \       |    |   /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11078
    //     dst=cmovI_bso_stackSlotL_conLvalue0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11079
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11080
    // with
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
    //   region  dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11083
    //    \       /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11084
    //     dst=loadConI16(0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11085
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11086
    //      ^  region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11087
    //      |   \       |    |    /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11088
    //      dst=cmovI_bso_stackSlotL
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11089
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11090
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11091
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11092
    MachNode *m1 = new loadConI16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11093
    MachNode *m2 = new cmovI_bso_stackSlotLNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11094
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11095
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11096
    m1->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11097
    m2->add_req(n_region, n_crx, n_mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11098
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11099
    // precedences for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11100
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11101
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11102
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11103
    m1->_opnds[0] = op_dst;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11104
    m1->_opnds[1] = new immI16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11105
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11106
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11107
    m2->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11108
    m2->_opnds[2] = op_mem;
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
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11111
    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
 11112
    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
 11113
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11114
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11115
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11116
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11117
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11118
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11119
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11120
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
 11121
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11122
  effect(DEF dst, USE crx, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11123
  predicate(false);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11124
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11125
  format %{ "CmovI   $dst, $crx, $src \t// postalloc expanded" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11126
  postalloc_expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11127
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11128
    // replaces
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11129
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11130
    //   region  dst  crx  src
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11131
    //    \       |    |   /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11132
    //     dst=cmovI_bso_reg_conLvalue0
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11133
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11134
    // with
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
    //   region  dst
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11137
    //    \       /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11138
    //     dst=loadConI16(0)
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11139
    //      |
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11140
    //      ^  region  dst  crx  src
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11141
    //      |   \       |    |    /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11142
    //      dst=cmovI_bso_reg
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
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11145
    // Create new nodes.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11146
    MachNode *m1 = new loadConI16Node();
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11147
    MachNode *m2 = new cmovI_bso_regNode();
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11148
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11149
    // inputs for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11150
    m1->add_req(n_region);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11151
    m2->add_req(n_region, n_crx, n_src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11152
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11153
    // precedences for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11154
    m2->add_prec(m1);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11155
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11156
    // operands for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11157
    m1->_opnds[0] = op_dst;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11158
    m1->_opnds[1] = new immI16Oper(0);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11159
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11160
    m2->_opnds[0] = op_dst;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11161
    m2->_opnds[1] = op_crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11162
    m2->_opnds[2] = op_src;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11163
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11164
    // registers for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11165
    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
 11166
    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
 11167
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11168
    // Insert new nodes.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11169
    nodes->push(m1);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11170
    nodes->push(m2);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11171
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11172
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11173
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11174
// Double to Int conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11175
instruct convD2I_reg_ExEx(iRegIdst dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11176
  match(Set dst (ConvD2I src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11177
  predicate(!VM_Version::has_mtfprd());
22861
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
    regD tmpD;
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
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11184
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11185
    convD2IRaw_regD(tmpD, src);                         // Convert float to int (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11186
    moveD2L_reg_stack(tmpS, tmpD);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11187
    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
 11188
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11189
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11190
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11191
// 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
 11192
instruct convD2I_reg_mffprd_ExEx(iRegIdst dst, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11193
  match(Set dst (ConvD2I src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11194
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11195
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11196
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11197
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11198
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11199
    flagsReg crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11200
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11201
    convD2IRaw_regD(tmpD, src);                         // Convert float to int (speculated).
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11202
    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
 11203
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11204
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11205
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11206
instruct convF2IRaw_regF(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11207
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11208
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11209
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11210
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11211
  format %{ "FCTIWZ $dst, $src \t// convF2I, $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11212
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11213
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11214
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11215
    __ fctiwz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11216
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11217
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11218
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11219
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11220
// Float to Int conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11221
instruct convF2I_regF_ExEx(iRegIdst dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11222
  match(Set dst (ConvF2I src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11223
  predicate(!VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11224
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11225
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11226
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11227
    regF tmpF;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11228
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11229
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11230
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11231
    convF2IRaw_regF(tmpF, src);                         // Convert float to int (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11232
    moveF2L_reg_stack(tmpS, tmpF);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11233
    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
 11234
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11235
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11236
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11237
// 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
 11238
instruct convF2I_regF_mffprd_ExEx(iRegIdst dst, regF src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11239
  match(Set dst (ConvF2I src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11240
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11241
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11242
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11243
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11244
    regF tmpF;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11245
    flagsReg crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11246
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11247
    convF2IRaw_regF(tmpF, src);                         // Convert float to int (speculated).
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11248
    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
 11249
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11250
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11251
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11252
// Convert to Long
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11253
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11254
instruct convI2L_reg(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11255
  match(Set dst (ConvI2L src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11256
  format %{ "EXTSW   $dst, $src \t// int->long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11257
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11258
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11259
    // TODO: PPC port $archOpcode(ppc64Opcode_extsw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11260
    __ extsw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11261
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11262
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11263
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11264
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11265
// Zero-extend: convert unsigned int to long (convUI2L).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11266
instruct zeroExtendL_regI(iRegLdst dst, iRegIsrc src, immL_32bits mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11267
  match(Set dst (AndL (ConvI2L src) mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11268
  ins_cost(DEFAULT_COST);
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
  format %{ "CLRLDI  $dst, $src, #32 \t// zero-extend int to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11271
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11272
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11273
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11274
    __ clrldi($dst$$Register, $src$$Register, 32);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11277
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11278
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11279
// Zero-extend: convert unsigned int to long in long register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11280
instruct zeroExtendL_regL(iRegLdst dst, iRegLsrc src, immL_32bits mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11281
  match(Set dst (AndL src mask));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11282
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11283
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11284
  format %{ "CLRLDI  $dst, $src, #32 \t// zero-extend int to long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11285
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11286
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11287
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11288
    __ clrldi($dst$$Register, $src$$Register, 32);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11289
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11290
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11291
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11292
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11293
instruct convF2LRaw_regF(regF dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11294
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11295
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11296
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11297
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11298
  format %{ "FCTIDZ $dst, $src \t// convF2L, $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11299
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11300
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11301
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11302
    __ fctidz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11303
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11304
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11305
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11306
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11307
instruct cmovL_bso_stackSlotL(iRegLdst dst, flagsRegSrc crx, stackSlotL src) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11308
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11309
  effect(DEF dst, USE crx, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11310
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11311
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11312
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11313
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11314
  format %{ "cmovL   $crx, $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11315
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11316
  size(false /* TODO: PPC PORT Compile::current()->do_hb_scheduling()*/ ? 12 : 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11317
  ins_encode( enc_cmove_bso_stackSlotL(dst, crx, src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11318
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11319
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11320
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11321
instruct cmovL_bso_reg(iRegLdst dst, flagsRegSrc crx, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11322
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11323
  effect(DEF dst, USE crx, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11324
  predicate(false);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11325
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11326
  ins_variable_size_depending_on_alignment(true);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11327
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11328
  format %{ "cmovL   $crx, $dst, $src" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11329
  // Worst case is branch + move + stop, no stop without scheduler.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11330
  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
 11331
  ins_encode( enc_cmove_bso_reg(dst, crx, src) );
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11332
  ins_pipe(pipe_class_default);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11333
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11334
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11335
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
 11336
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11337
  effect(DEF dst, USE crx, USE mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11338
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11339
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11340
  format %{ "CmovL   $dst, $crx, $mem \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11341
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11342
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11343
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11344
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11345
    //   region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11346
    //    \       |    |   /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11347
    //     dst=cmovL_bso_stackSlotL_conLvalue0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11348
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11349
    // with
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
    //   region  dst
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11352
    //    \       /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11353
    //     dst=loadConL16(0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11354
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11355
    //      ^  region  dst  crx  mem
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11356
    //      |   \       |    |    /
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11357
    //      dst=cmovL_bso_stackSlotL
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11360
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11361
    MachNode *m1 = new loadConL16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11362
    MachNode *m2 = new cmovL_bso_stackSlotLNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11363
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11364
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11365
    m1->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11366
    m2->add_req(n_region, n_crx, n_mem);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11367
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11368
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11369
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11370
    m1->_opnds[0] = op_dst;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11371
    m1->_opnds[1] = new immL16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11372
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11373
    m2->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11374
    m2->_opnds[2] = op_mem;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11375
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11376
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11377
    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
 11378
    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
 11379
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11380
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11381
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11382
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11383
  %}
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
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11386
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
 11387
  // no match-rule, false predicate
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11388
  effect(DEF dst, USE crx, USE src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11389
  predicate(false);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11390
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11391
  format %{ "CmovL   $dst, $crx, $src \t// postalloc expanded" %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11392
  postalloc_expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11393
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11394
    // replaces
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11395
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11396
    //   region  dst  crx  src
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11397
    //    \       |    |   /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11398
    //     dst=cmovL_bso_reg_conLvalue0
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11399
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11400
    // with
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11401
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11402
    //   region  dst
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11403
    //    \       /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11404
    //     dst=loadConL16(0)
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11405
    //      |
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11406
    //      ^  region  dst  crx  src
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11407
    //      |   \       |    |    /
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11408
    //      dst=cmovL_bso_reg
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11409
    //
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11410
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11411
    // Create new nodes.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11412
    MachNode *m1 = new loadConL16Node();
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11413
    MachNode *m2 = new cmovL_bso_regNode();
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11414
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11415
    // inputs for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11416
    m1->add_req(n_region);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11417
    m2->add_req(n_region, n_crx, n_src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11418
    m2->add_prec(m1);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11419
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11420
    // operands for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11421
    m1->_opnds[0] = op_dst;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11422
    m1->_opnds[1] = new immL16Oper(0);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11423
    m2->_opnds[0] = op_dst;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11424
    m2->_opnds[1] = op_crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11425
    m2->_opnds[2] = op_src;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11426
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11427
    // registers for new nodes
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11428
    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
 11429
    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
 11430
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11431
    // Insert new nodes.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11432
    nodes->push(m1);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11433
    nodes->push(m2);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11434
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11435
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11436
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11437
// Float to Long conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11438
instruct convF2L_reg_ExEx(iRegLdst dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11439
  match(Set dst (ConvF2L src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11440
  predicate(!VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11441
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11442
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11443
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11444
    regF tmpF;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11445
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11446
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11447
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11448
    convF2LRaw_regF(tmpF, src);                         // Convert float to long (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11449
    moveF2L_reg_stack(tmpS, tmpF);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11450
    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
 11451
  %}
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
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11454
// 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
 11455
instruct convF2L_reg_mffprd_ExEx(iRegLdst dst, regF src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11456
  match(Set dst (ConvF2L src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11457
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11458
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11459
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11460
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11461
    regF tmpF;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11462
    flagsReg crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11463
    cmpFUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11464
    convF2LRaw_regF(tmpF, src);                         // Convert float to long (speculated).
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11465
    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
 11466
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11467
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11468
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11469
instruct convD2LRaw_regD(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11470
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11471
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11472
  predicate(false);
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
  format %{ "FCTIDZ $dst, $src \t// convD2L $src != NaN" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11475
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11476
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11477
    // TODO: PPC port $archOpcode(ppc64Opcode_fctiwz);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11478
    __ fctidz($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11479
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11480
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11481
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11482
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11483
// Double to Long conversion, NaN is mapped to 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11484
instruct convD2L_reg_ExEx(iRegLdst dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11485
  match(Set dst (ConvD2L src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11486
  predicate(!VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11487
  ins_cost(DEFAULT_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11490
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11491
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11492
    flagsReg crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11493
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11494
    convD2LRaw_regD(tmpD, src);                         // Convert float to long (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11495
    moveD2L_reg_stack(tmpS, tmpD);                      // Store float to stack (speculated).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11496
    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
 11497
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11498
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11499
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11500
// 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
 11501
instruct convD2L_reg_mffprd_ExEx(iRegLdst dst, regD src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11502
  match(Set dst (ConvD2L src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11503
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11504
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11505
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11506
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11507
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11508
    flagsReg crx;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11509
    cmpDUnordered_reg_reg(crx, src, src);               // Check whether src is NaN.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11510
    convD2LRaw_regD(tmpD, src);                         // Convert float to long (speculated).
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11511
    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
 11512
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11513
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11514
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11515
// Convert to Float
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11516
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11517
// Placed here as needed in expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11518
instruct convL2DRaw_regD(regD dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11519
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11520
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11521
  predicate(false);
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
  format %{ "FCFID $dst, $src \t// convL2D" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11524
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11525
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11526
    // TODO: PPC port $archOpcode(ppc64Opcode_fcfid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11527
    __ fcfid($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11528
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11529
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11530
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11531
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11532
// Placed here as needed in expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11533
instruct convD2F_reg(regF dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11534
  match(Set dst (ConvD2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11535
  format %{ "FRSP    $dst, $src \t// convD2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11536
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11537
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11538
    // TODO: PPC port $archOpcode(ppc64Opcode_frsp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11539
    __ frsp($dst$$FloatRegister, $src$$FloatRegister);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11542
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11543
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11544
// Integer to Float conversion.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11545
instruct convI2F_ireg_Ex(regF dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11546
  match(Set dst (ConvI2F src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11547
  predicate(!VM_Version::has_fcfids());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11548
  ins_cost(DEFAULT_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11551
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11552
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11553
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11554
    regD tmpD2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11555
    convI2L_reg(tmpL, src);              // Sign-extension int to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11556
    regL_to_stkL(tmpS, tmpL);            // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11557
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11558
    convL2DRaw_regD(tmpD2, tmpD);        // Convert to double.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11559
    convD2F_reg(dst, tmpD2);             // Convert double to float.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11560
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11561
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11562
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11563
instruct convL2FRaw_regF(regF dst, regD src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11564
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11565
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11566
  predicate(false);
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
  format %{ "FCFIDS $dst, $src \t// convL2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11569
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11570
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11571
    // TODO: PPC port $archOpcode(ppc64Opcode_fcfid);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11572
    __ fcfids($dst$$FloatRegister, $src$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11573
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11574
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11575
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11576
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11577
// Integer to Float conversion. Special version for Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11578
instruct convI2F_ireg_fcfids_Ex(regF dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11579
  match(Set dst (ConvI2F src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11580
  predicate(VM_Version::has_fcfids() && !VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11581
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11582
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11583
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11584
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11585
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11586
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11587
    convI2L_reg(tmpL, src);              // Sign-extension int to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11588
    regL_to_stkL(tmpS, tmpL);            // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11589
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11590
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11593
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11594
// Integer to Float conversion. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11595
instruct convI2F_ireg_mtfprd_Ex(regF dst, iRegIsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11596
  match(Set dst (ConvI2F src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11597
  predicate(VM_Version::has_fcfids() && VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11598
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11599
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11600
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11601
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11602
    moveI2D_reg(tmpD, src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11603
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11604
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11605
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11606
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11607
// L2F to avoid runtime call.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11608
instruct convL2F_ireg_fcfids_Ex(regF dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11609
  match(Set dst (ConvL2F src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11610
  predicate(VM_Version::has_fcfids() && !VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11611
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11612
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11613
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11614
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11615
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11616
    regL_to_stkL(tmpS, src);             // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11617
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11618
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11619
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11620
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11621
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11622
// L2F to avoid runtime call.  Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11623
instruct convL2F_ireg_mtfprd_Ex(regF dst, iRegLsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11624
  match(Set dst (ConvL2F src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11625
  predicate(VM_Version::has_fcfids() && VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11626
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11627
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11628
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11629
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11630
    moveL2D_reg(tmpD, src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11631
    convL2FRaw_regF(dst, tmpD);          // Convert to float.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11632
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11633
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11634
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11635
// Moved up as used in expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11636
//instruct convD2F_reg(regF dst, regD src) %{%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11637
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11638
// Convert to Double
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11639
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11640
// Integer to Double conversion.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11641
instruct convI2D_reg_Ex(regD dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11642
  match(Set dst (ConvI2D src));
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11643
  predicate(!VM_Version::has_mtfprd());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11644
  ins_cost(DEFAULT_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11647
    iRegLdst tmpL;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11648
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11649
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11650
    convI2L_reg(tmpL, src);              // Sign-extension int to long.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11651
    regL_to_stkL(tmpS, tmpL);            // Store long to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11652
    moveL2D_stack_reg(tmpD, tmpS);       // Load long into double register.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11653
    convL2DRaw_regD(dst, tmpD);          // Convert to double.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11654
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11655
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11656
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11657
// Integer to Double conversion. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11658
instruct convI2D_reg_mtfprd_Ex(regD dst, iRegIsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11659
  match(Set dst (ConvI2D src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11660
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11661
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11662
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11663
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11664
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11665
    moveI2D_reg(tmpD, src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11666
    convL2DRaw_regD(dst, tmpD);          // Convert to double.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11667
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11668
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11669
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11670
// Long to Double conversion
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11671
instruct convL2D_reg_Ex(regD dst, stackSlotL src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11672
  match(Set dst (ConvL2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11673
  ins_cost(DEFAULT_COST + MEMORY_REF_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11674
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11675
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11676
    regD tmpD;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11677
    moveL2D_stack_reg(tmpD, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11678
    convL2DRaw_regD(dst, tmpD);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11679
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11680
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11681
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11682
// Long to Double conversion. Special version for Power8.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11683
instruct convL2D_reg_mtfprd_Ex(regD dst, iRegLsrc src) %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11684
  match(Set dst (ConvL2D src));
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11685
  predicate(VM_Version::has_mtfprd());
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11686
  ins_cost(DEFAULT_COST);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11687
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11688
  expand %{
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11689
    regD tmpD;
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11690
    moveL2D_reg(tmpD, src);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11691
    convL2DRaw_regD(dst, tmpD);          // Convert to double.
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11692
  %}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11693
%}
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46555
diff changeset
 11694
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11695
instruct convF2D_reg(regD dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11696
  match(Set dst (ConvF2D src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11697
  format %{ "FMR     $dst, $src \t// float->double" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11698
  // variable size, 0 or 4
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11699
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11700
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11701
    __ fmr_if_needed($dst$$FloatRegister, $src$$FloatRegister);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11704
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11705
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11706
//----------Control Flow Instructions------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11707
// Compare Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11708
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11709
// Compare Integers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11710
instruct cmpI_reg_reg(flagsReg crx, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11711
  match(Set crx (CmpI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11712
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11713
  format %{ "CMPW    $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11714
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11715
    // TODO: PPC port $archOpcode(ppc64Opcode_cmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11716
    __ cmpw($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11717
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11718
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11719
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11720
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11721
instruct cmpI_reg_imm16(flagsReg crx, iRegIsrc src1, immI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11722
  match(Set crx (CmpI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11723
  format %{ "CMPWI   $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11724
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11725
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11726
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11727
    __ cmpwi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11728
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11729
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11730
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11731
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11732
// (src1 & src2) == 0?
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11733
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
 11734
  match(Set cr0 (CmpI (AndI src1 src2) zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11735
  // r0 is killed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11736
  format %{ "ANDI    R0, $src1, $src2 \t// BTST int" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11737
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11738
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11739
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11740
    __ andi_(R0, $src1$$Register, $src2$$constant);
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
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11743
%}
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 cmpL_reg_reg(flagsReg crx, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11746
  match(Set crx (CmpL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11747
  format %{ "CMPD    $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11748
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11749
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11750
    // TODO: PPC port $archOpcode(ppc64Opcode_cmp);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11751
    __ cmpd($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11752
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11753
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11754
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11755
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11756
instruct cmpL_reg_imm16(flagsReg crx, iRegLsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11757
  match(Set crx (CmpL src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11758
  format %{ "CMPDI   $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11759
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11760
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11761
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11762
    __ cmpdi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11763
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11764
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11765
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11766
45966
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11767
// Added CmpUL for LoopPredicate.
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11768
instruct cmpUL_reg_reg(flagsReg crx, iRegLsrc src1, iRegLsrc src2) %{
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11769
  match(Set crx (CmpUL src1 src2));
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11770
  format %{ "CMPLD   $crx, $src1, $src2" %}
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11771
  size(4);
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11772
  ins_encode %{
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11773
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11774
    __ cmpld($crx$$CondRegister, $src1$$Register, $src2$$Register);
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11775
  %}
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11776
  ins_pipe(pipe_class_compare);
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11777
%}
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11778
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11779
instruct cmpUL_reg_imm16(flagsReg crx, iRegLsrc src1, uimmL16 src2) %{
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11780
  match(Set crx (CmpUL src1 src2));
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11781
  format %{ "CMPLDI  $crx, $src1, $src2" %}
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11782
  size(4);
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11783
  ins_encode %{
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11784
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpli);
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11785
    __ cmpldi($crx$$CondRegister, $src1$$Register, $src2$$constant);
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11786
  %}
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11787
  ins_pipe(pipe_class_compare);
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11788
%}
b2019823b5bd 8181420: PPC: Image conversion improvements
mdoerr
parents: 42884
diff changeset
 11789
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11790
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
 11791
  match(Set cr0 (CmpL (AndL src1 src2) zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11792
  // r0 is killed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11793
  format %{ "AND     R0, $src1, $src2 \t// BTST long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11794
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11795
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11796
    // TODO: PPC port $archOpcode(ppc64Opcode_and_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11797
    __ and_(R0, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11798
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11799
  ins_pipe(pipe_class_compare);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11802
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
 11803
  match(Set cr0 (CmpL (AndL src1 src2) zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11804
  // r0 is killed
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11805
  format %{ "ANDI    R0, $src1, $src2 \t// BTST long" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11806
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11807
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11808
    // TODO: PPC port $archOpcode(ppc64Opcode_andi_);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11809
    __ andi_(R0, $src1$$Register, $src2$$constant);
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
  ins_pipe(pipe_class_compare);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11814
instruct cmovI_conIvalueMinus1_conIvalue1(iRegIdst dst, flagsRegSrc crx) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11815
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11816
  effect(DEF dst, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11817
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11818
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11819
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11820
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11821
  format %{ "cmovI   $crx, $dst, -1, 0, +1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11822
  // Worst case is branch + move + branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11823
  size(false /* TODO: PPC PORTInsertEndGroupPPC64 && Compile::current()->do_hb_scheduling())*/ ? 20 : 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11824
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11825
    // TODO: PPC port $archOpcode(ppc64Opcode_cmove);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11826
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11827
    // li(Rdst, 0);              // equal -> 0
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11828
    __ beq($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11829
    __ li($dst$$Register, 1);    // greater -> +1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11830
    __ bgt($crx$$CondRegister, done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11831
    __ li($dst$$Register, -1);   // unordered or less -> -1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11832
    // TODO: PPC port__ endgroup_if_needed(_size == 20);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11833
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11834
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11835
  ins_pipe(pipe_class_compare);
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
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 11838
instruct cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(iRegIdst dst, flagsRegSrc crx) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11839
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11840
  effect(DEF dst, USE crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11841
  predicate(false);
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
  format %{ "CmovI    $crx, $dst, -1, 0, +1 \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11844
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11845
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11846
    // replaces
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
    //   region  crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11849
    //    \       |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11850
    //     dst=cmovI_conIvalueMinus1_conIvalue0_conIvalue1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11851
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11852
    // with
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
    //   region
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11855
    //    \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11856
    //     dst=loadConI16(0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11857
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11858
    //      ^  region  crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11859
    //      |   \       |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11860
    //      dst=cmovI_conIvalueMinus1_conIvalue1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11861
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11862
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11863
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11864
    MachNode *m1 = new loadConI16Node();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11865
    MachNode *m2 = new cmovI_conIvalueMinus1_conIvalue1Node();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11866
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11867
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11868
    m1->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11869
    m2->add_req(n_region, n_crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11870
    m2->add_prec(m1);
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
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11873
    m1->_opnds[0] = op_dst;
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 11874
    m1->_opnds[1] = new immI16Oper(0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11875
    m2->_opnds[0] = op_dst;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11876
    m2->_opnds[1] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11877
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11878
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11879
    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
 11880
    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
 11881
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11882
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11883
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11884
    nodes->push(m2);
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
%}
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
// Manifest a CmpL3 result in an integer register. Very painful.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11889
// This is the test to avoid.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11890
// (src1 < src2) ? -1 : ((src1 > src2) ? 1 : 0)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11891
instruct cmpL3_reg_reg_ExEx(iRegIdst dst, iRegLsrc src1, iRegLsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11892
  match(Set dst (CmpL3 src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11893
  ins_cost(DEFAULT_COST*5+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11894
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11895
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11896
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11897
    cmpL_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11898
    cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(dst, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11899
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11900
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11901
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11902
// Implicit range checks.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11903
// 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
 11904
//  - (If le (CmpU length index)), (IfTrue  throw exception)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11905
//  - (If lt (CmpU index length)), (IfFalse throw exception)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11906
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11907
// Match range check 'If le (CmpU length index)'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11908
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
 11909
  match(If cmp (CmpU src_length index));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11910
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11911
  predicate(TrapBasedRangeChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11912
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::le &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11913
            PROB_UNLIKELY(_leaf->as_If()->_prob) >= PROB_ALWAYS &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11914
            (Matcher::branches_to_uncommon_trap(_leaf)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11915
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11916
  ins_is_TrapBasedCheckNode(true);
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
  format %{ "TWI     $index $cmp $src_length \t// RangeCheck => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11919
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11920
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11921
    // TODO: PPC port $archOpcode(ppc64Opcode_twi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11922
    if ($cmp$$cmpcode == 0x1 /* less_equal */) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11923
      __ trap_range_check_le($src_length$$Register, $index$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11924
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11925
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11926
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11927
      assert($cmp$$cmpcode == 0x9, "must be greater");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11928
      __ trap_range_check_g($src_length$$Register, $index$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11929
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11930
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11931
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11932
%}
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
// Match range check 'If lt (CmpU index length)'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11935
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
 11936
  match(If cmp (CmpU src_index src_length));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11937
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11938
  predicate(TrapBasedRangeChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11939
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::lt &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11940
            _leaf->as_If()->_prob >= PROB_ALWAYS &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11941
            (Matcher::branches_to_uncommon_trap(_leaf)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11942
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11943
  ins_is_TrapBasedCheckNode(true);
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 %{ "TW      $src_index $cmp $src_length \t// RangeCheck => trap $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_tw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11949
    if ($cmp$$cmpcode == 0x0 /* greater_equal */) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11950
      __ trap_range_check_ge($src_index$$Register, $src_length$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11951
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11952
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11953
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11954
      assert($cmp$$cmpcode == 0x8, "must be less");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11955
      __ trap_range_check_l($src_index$$Register, $src_length$$Register);
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
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11958
  ins_pipe(pipe_class_trap);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11961
// Match range check 'If lt (CmpU index length)'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11962
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
 11963
  match(If cmp (CmpU src_index length));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11964
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11965
  predicate(TrapBasedRangeChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11966
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::lt &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11967
            _leaf->as_If()->_prob >= PROB_ALWAYS &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11968
            (Matcher::branches_to_uncommon_trap(_leaf)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11969
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11970
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11971
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11972
  format %{ "TWI     $src_index $cmp $length \t// RangeCheck => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11973
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11974
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11975
    // TODO: PPC port $archOpcode(ppc64Opcode_twi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11976
    if ($cmp$$cmpcode == 0x0 /* greater_equal */) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11977
      __ trap_range_check_ge($src_index$$Register, $length$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11978
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11979
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11980
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11981
      assert($cmp$$cmpcode == 0x8, "must be less");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11982
      __ trap_range_check_l($src_index$$Register, $length$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11983
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11984
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11985
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11986
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11987
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11988
instruct compU_reg_reg(flagsReg crx, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11989
  match(Set crx (CmpU src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11990
  format %{ "CMPLW   $crx, $src1, $src2 \t// unsigned" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11991
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11992
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11993
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11994
    __ cmplw($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11995
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11996
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11997
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11998
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 11999
instruct compU_reg_uimm16(flagsReg crx, iRegIsrc src1, uimmI16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12000
  match(Set crx (CmpU src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12001
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12002
  format %{ "CMPLWI  $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12003
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12004
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12005
    __ cmplwi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12006
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12007
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12008
%}
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
// Implicit zero checks (more implicit null checks).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12011
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12012
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
 12013
  match(If cmp (CmpN value zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12014
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12015
  predicate(TrapBasedNullChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12016
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ne &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12017
            _leaf->as_If()->_prob >= PROB_LIKELY_MAG(4) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12018
            Matcher::branches_to_uncommon_trap(_leaf));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12019
  ins_cost(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12020
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12021
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12022
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12023
  format %{ "TDI     $value $cmp $zero \t// ZeroCheckN => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12024
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12025
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12026
    // TODO: PPC port $archOpcode(ppc64Opcode_tdi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12027
    if ($cmp$$cmpcode == 0xA) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12028
      __ trap_null_check($value$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12029
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12030
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12031
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12032
      assert($cmp$$cmpcode == 0x2 , "must be equal(0xA) or notEqual(0x2)");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12033
      __ trap_null_check($value$$Register, Assembler::traptoGreaterThanUnsigned);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12034
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12035
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12036
  ins_pipe(pipe_class_trap);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12037
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12038
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12039
// Compare narrow oops.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12040
instruct cmpN_reg_reg(flagsReg crx, iRegNsrc src1, iRegNsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12041
  match(Set crx (CmpN src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12042
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12043
  size(4);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
 12044
  ins_cost(2);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12045
  format %{ "CMPLW   $crx, $src1, $src2 \t// compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12046
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12047
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12048
    __ cmplw($crx$$CondRegister, $src1$$Register, $src2$$Register);
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
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12051
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12052
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12053
instruct cmpN_reg_imm0(flagsReg crx, iRegNsrc src1, immN_0 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12054
  match(Set crx (CmpN src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12055
  // Make this more expensive than zeroCheckN_iReg_imm0.
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
 12056
  ins_cost(2);
22861
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
  format %{ "CMPLWI  $crx, $src1, $src2 \t// compressed ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12059
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12060
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12061
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpli);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12062
    __ cmplwi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12063
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12064
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12065
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12066
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12067
// Implicit zero checks (more implicit null checks).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12068
// No constant pool entries required.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12069
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
 12070
  match(If cmp (CmpP value zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12071
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12072
  predicate(TrapBasedNullChecks &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12073
            _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ne &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12074
            _leaf->as_If()->_prob >= PROB_LIKELY_MAG(4) &&
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12075
            Matcher::branches_to_uncommon_trap(_leaf));
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
 12076
  ins_cost(1); // Should not be cheaper than zeroCheckN.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12077
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12078
  ins_is_TrapBasedCheckNode(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12079
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12080
  format %{ "TDI     $value $cmp $zero \t// ZeroCheckP => trap $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12081
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12082
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12083
    // TODO: PPC port $archOpcode(ppc64Opcode_tdi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12084
    if ($cmp$$cmpcode == 0xA) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12085
      __ trap_null_check($value$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12086
    } else {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12087
      // Both successors are uncommon traps, probability is 0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12088
      // Node got flipped during fixup flow.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12089
      assert($cmp$$cmpcode == 0x2 , "must be equal(0xA) or notEqual(0x2)");
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12090
      __ trap_null_check($value$$Register, Assembler::traptoGreaterThanUnsigned);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12091
    }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12092
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12093
  ins_pipe(pipe_class_trap);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12096
// Compare Pointers
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12097
instruct cmpP_reg_reg(flagsReg crx, iRegP_N2P src1, iRegP_N2P src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12098
  match(Set crx (CmpP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12099
  format %{ "CMPLD   $crx, $src1, $src2 \t// ptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12100
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12101
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12102
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12103
    __ cmpld($crx$$CondRegister, $src1$$Register, $src2$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12104
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12105
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12106
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12107
42072
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12108
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
 12109
  match(Set crx (CmpP src1 src2));
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12110
  format %{ "CMPLDI   $crx, $src1, $src2 \t// ptr" %}
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12111
  size(4);
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12112
  ins_encode %{
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12113
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12114
    __ cmpldi($crx$$CondRegister, $src1$$Register, (int)((short)($src2$$constant & 0xFFFF)));
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12115
  %}
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12116
  ins_pipe(pipe_class_compare);
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12117
%}
d7029af8cb0c 8168318: PPC64: Use cmpldi instead of li/cmpld
goetz
parents: 41685
diff changeset
 12118
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12119
// Used in postalloc expand.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12120
instruct cmpP_reg_imm16(flagsReg crx, iRegPsrc src1, immL16 src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12121
  // This match rule prevents reordering of node before a safepoint.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12122
  // This only makes sense if this instructions is used exclusively
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12123
  // for the expansion of EncodeP!
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12124
  match(Set crx (CmpP src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12125
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12126
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12127
  format %{ "CMPDI   $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12128
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12129
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12130
    // TODO: PPC port $archOpcode(ppc64Opcode_cmpi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12131
    __ cmpdi($crx$$CondRegister, $src1$$Register, $src2$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12132
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12133
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12134
%}
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
//----------Float Compares----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12137
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12138
instruct cmpFUnordered_reg_reg(flagsReg crx, regF src1, regF src2) %{
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12139
  // Needs matchrule, see cmpDUnordered.
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
 12140
  match(Set crx (CmpF src1 src2));
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12141
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12142
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12143
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12144
  format %{ "cmpFUrd $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12145
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12146
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12147
    // TODO: PPC port $archOpcode(ppc64Opcode_fcmpu);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12148
    __ fcmpu($crx$$CondRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12149
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12150
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12151
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12152
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12153
instruct cmov_bns_less(flagsReg crx) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12154
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12155
  effect(DEF crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12156
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12157
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12158
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12159
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12160
  format %{ "cmov    $crx" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12161
  // Worst case is branch + move + stop, no stop without scheduler.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12162
  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
 12163
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12164
    // TODO: PPC port $archOpcode(ppc64Opcode_cmovecr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12165
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12166
    __ bns($crx$$CondRegister, done);        // not unordered -> keep crx
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12167
    __ li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12168
    __ cmpwi($crx$$CondRegister, R0, 1);     // unordered -> set crx to 'less'
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12169
    // TODO PPC port __ endgroup_if_needed(_size == 16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12170
    __ bind(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12171
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12172
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12175
// Compare floating, generate condition code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12176
instruct cmpF_reg_reg_Ex(flagsReg crx, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12177
  // FIXME: should we match 'If cmp (CmpF src1 src2))' ??
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12178
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12179
  // The following code sequence occurs a lot in mpegaudio:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12180
  //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12181
  // block BXX:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12182
  // 0: instruct cmpFUnordered_reg_reg (cmpF_reg_reg-0):
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12183
  //    cmpFUrd CCR6, F11, F9
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12184
  // 4: instruct cmov_bns_less (cmpF_reg_reg-1):
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12185
  //    cmov CCR6
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12186
  // 8: instruct branchConSched:
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12187
  //    B_FARle CCR6, B56  P=0.500000 C=-1.000000
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12188
  match(Set crx (CmpF src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12189
  ins_cost(DEFAULT_COST+BRANCH_COST);
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 %{ "CmpF    $crx, $src1, $src2 \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12192
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12193
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12194
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12195
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12196
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12197
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12198
    //     crx=cmpF_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12199
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12200
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12201
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12202
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12203
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12204
    //     crx=cmpFUnordered_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12205
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12206
    //      ^  region
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12207
    //      |   \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12208
    //      crx=cmov_bns_less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12209
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12210
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12211
    // Create new nodes.
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 12212
    MachNode *m1 = new cmpFUnordered_reg_regNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 12213
    MachNode *m2 = new cmov_bns_lessNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12214
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12215
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12216
    m1->add_req(n_region, n_src1, n_src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12217
    m2->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12218
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12219
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12220
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12221
    m1->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12222
    m1->_opnds[1] = op_src1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12223
    m1->_opnds[2] = op_src2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12224
    m2->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12225
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12226
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12227
    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
 12228
    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
 12229
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12230
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12231
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12232
    nodes->push(m2);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12235
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12236
// Compare float, generate -1,0,1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12237
instruct cmpF3_reg_reg_ExEx(iRegIdst dst, regF src1, regF src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12238
  match(Set dst (CmpF3 src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12239
  ins_cost(DEFAULT_COST*5+BRANCH_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12242
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12243
    cmpFUnordered_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12244
    cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(dst, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12245
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12246
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12247
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12248
instruct cmpDUnordered_reg_reg(flagsReg crx, regD src1, regD src2) %{
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
 12249
  // 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
 12250
  // node right before the conditional move using it.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12251
  // In jck test api/java_awt/geom/QuadCurve2DFloat/index.html#SetCurveTesttestCase7,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12252
  // compilation of java.awt.geom.RectangularShape::getBounds()Ljava/awt/Rectangle
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12253
  // crashed in register allocation where the flags Reg between cmpDUnoredered and a
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12254
  // conditional move was supposed to be spilled.
34162
16b54851eaf6 8140779: Code generation fixes for avx512
iveresov
parents: 33628
diff changeset
 12255
  match(Set crx (CmpD src1 src2));
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12256
  // False predicate, shall not be matched.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12257
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12258
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12259
  format %{ "cmpFUrd $crx, $src1, $src2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12260
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12261
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12262
    // TODO: PPC port $archOpcode(ppc64Opcode_fcmpu);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12263
    __ fcmpu($crx$$CondRegister, $src1$$FloatRegister, $src2$$FloatRegister);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12264
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12265
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12266
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12267
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12268
instruct cmpD_reg_reg_Ex(flagsReg crx, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12269
  match(Set crx (CmpD src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12270
  ins_cost(DEFAULT_COST+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12271
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12272
  format %{ "CmpD    $crx, $src1, $src2 \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12273
  postalloc_expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12274
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12275
    // replaces
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12276
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12277
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12278
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12279
    //     crx=cmpD_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12280
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12281
    // with
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12282
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12283
    //   region  src1  src2
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12284
    //    \       |     |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12285
    //     crx=cmpDUnordered_reg_reg
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12286
    //      |
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12287
    //      ^  region
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12288
    //      |   \
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12289
    //      crx=cmov_bns_less
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12290
    //
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12291
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12292
    // create new nodes
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 12293
    MachNode *m1 = new cmpDUnordered_reg_regNode();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24349
diff changeset
 12294
    MachNode *m2 = new cmov_bns_lessNode();
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12295
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12296
    // inputs for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12297
    m1->add_req(n_region, n_src1, n_src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12298
    m2->add_req(n_region);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12299
    m2->add_prec(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12300
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12301
    // operands for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12302
    m1->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12303
    m1->_opnds[1] = op_src1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12304
    m1->_opnds[2] = op_src2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12305
    m2->_opnds[0] = op_crx;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12306
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12307
    // registers for new nodes
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12308
    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
 12309
    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
 12310
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12311
    // Insert new nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12312
    nodes->push(m1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12313
    nodes->push(m2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12314
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12315
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12316
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12317
// Compare double, generate -1,0,1
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12318
instruct cmpD3_reg_reg_ExEx(iRegIdst dst, regD src1, regD src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12319
  match(Set dst (CmpD3 src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12320
  ins_cost(DEFAULT_COST*5+BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12321
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12322
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12323
    flagsReg tmp1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12324
    cmpDUnordered_reg_reg(tmp1, src1, src2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12325
    cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(dst, tmp1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12326
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12327
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12328
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12329
//----------Branches---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12330
// Jump
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12331
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12332
// Direct Branch.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12333
instruct branch(label labl) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12334
  match(Goto);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12335
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12336
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12337
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12338
  format %{ "B       $labl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12339
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12340
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12341
    // TODO: PPC port $archOpcode(ppc64Opcode_b);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12342
     Label d;    // dummy
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12343
     __ bind(d);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12344
     Label* p = $labl$$label;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12345
     // `p' is `NULL' when this encoding class is used only to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12346
     // determine the size of the encoded instruction.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12347
     Label& l = (NULL == p)? d : *(p);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12348
     __ b(l);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12349
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12350
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12351
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12352
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12353
// Conditional Near Branch
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12354
instruct branchCon(cmpOp cmp, flagsRegSrc crx, label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12355
  // Same match rule as `branchConFar'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12356
  match(If cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12357
  effect(USE lbl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12358
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12359
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12360
  // If set to 1 this indicates that the current instruction is a
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12361
  // short variant of a long branch. This avoids using this
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12362
  // instruction in first-pass matching. It will then only be used in
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12363
  // the `Shorten_branches' pass.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12364
  ins_short_branch(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12365
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12366
  format %{ "B$cmp     $crx, $lbl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12367
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12368
  ins_encode( enc_bc(crx, cmp, lbl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12369
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12370
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12371
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12372
// This is for cases when the ppc64 `bc' instruction does not
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12373
// 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
 12374
// expensive.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12375
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12376
// Conditional Far Branch
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12377
instruct branchConFar(cmpOp cmp, flagsRegSrc crx, label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12378
  // Same match rule as `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12379
  match(If cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12380
  effect(USE crx, USE lbl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12381
  predicate(!false /* TODO: PPC port HB_Schedule*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12382
  // Higher cost than `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12383
  ins_cost(5*BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12384
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12385
  // 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
 12386
  ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12387
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12388
  format %{ "B_FAR$cmp $crx, $lbl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12389
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12390
  ins_encode( enc_bc_far(crx, cmp, lbl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12391
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12392
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12393
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12394
// Conditional Branch used with Power6 scheduler (can be far or short).
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12395
instruct branchConSched(cmpOp cmp, flagsRegSrc crx, label lbl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12396
  // Same match rule as `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12397
  match(If cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12398
  effect(USE crx, USE lbl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12399
  predicate(false /* TODO: PPC port HB_Schedule*/);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12400
  // Higher cost than `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12401
  ins_cost(5*BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12402
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12403
  // Actually size doesn't depend on alignment but on shortening.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12404
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12405
  // long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12406
  ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12407
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12408
  format %{ "B_FAR$cmp $crx, $lbl" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12409
  size(8); // worst case
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12410
  ins_encode( enc_bc_short_far(crx, cmp, lbl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12411
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12412
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12413
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12414
instruct branchLoopEnd(cmpOp cmp, flagsRegSrc crx, label labl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12415
  match(CountedLoopEnd cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12416
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12417
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12418
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12419
  // short variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12420
  ins_short_branch(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12421
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12422
  format %{ "B$cmp     $crx, $labl \t// counted loop end" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12423
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12424
  ins_encode( enc_bc(crx, cmp, labl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12425
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12426
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12427
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12428
instruct branchLoopEndFar(cmpOp cmp, flagsRegSrc crx, label labl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12429
  match(CountedLoopEnd cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12430
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12431
  predicate(!false /* TODO: PPC port HB_Schedule */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12432
  ins_cost(BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12433
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12434
  // Long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12435
  ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12436
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12437
  format %{ "B_FAR$cmp $crx, $labl \t// counted loop end" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12438
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12439
  ins_encode( enc_bc_far(crx, cmp, labl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12440
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12441
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12442
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12443
// Conditional Branch used with Power6 scheduler (can be far or short).
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12444
instruct branchLoopEndSched(cmpOp cmp, flagsRegSrc crx, label labl) %{
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12445
  match(CountedLoopEnd cmp crx);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12446
  effect(USE labl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12447
  predicate(false /* TODO: PPC port HB_Schedule */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12448
  // Higher cost than `branchCon'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12449
  ins_cost(5*BRANCH_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12450
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12451
  // Actually size doesn't depend on alignment but on shortening.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12452
  ins_variable_size_depending_on_alignment(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12453
  // Long variant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12454
  ins_short_branch(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12455
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12456
  format %{ "B_FAR$cmp $crx, $labl \t// counted loop end" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12457
  size(8); // worst case
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12458
  ins_encode( enc_bc_short_far(crx, cmp, labl) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12459
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12460
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12461
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12462
// ============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12463
// Java runtime operations, intrinsics and other complex operations.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12464
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12465
// 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
 12466
// 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
 12467
// hit (cache is checked with exposed code in gen_subtype_check()). Return
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12468
// 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
 12469
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12470
// GL TODO: Improve this.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12471
// - result should not be a TEMP
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12472
// - Add match rule as on sparc avoiding additional Cmp.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12473
instruct partialSubtypeCheck(iRegPdst result, iRegP_N2P subklass, iRegP_N2P superklass,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12474
                             iRegPdst tmp_klass, iRegPdst tmp_arrayptr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12475
  match(Set result (PartialSubtypeCheck subklass superklass));
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
 12476
  effect(TEMP_DEF result, TEMP tmp_klass, TEMP tmp_arrayptr);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12477
  ins_cost(DEFAULT_COST*10);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12478
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12479
  format %{ "PartialSubtypeCheck $result = ($subklass instanceOf $superklass) tmp: $tmp_klass, $tmp_arrayptr" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12480
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12481
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 12482
    __ 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
 12483
                                     $tmp_klass$$Register, NULL, $result$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12484
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12485
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12486
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12487
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12488
// inlined locking and unlocking
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12489
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12490
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
 12491
  match(Set crx (FastLock oop box));
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12492
  effect(TEMP tmp1, TEMP tmp2);
31773
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30758
diff changeset
 12493
  predicate(!Compile::current()->use_rtm());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12494
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12495
  format %{ "FASTLOCK  $oop, $box, $tmp1, $tmp2" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12496
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12497
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12498
    __ compiler_fast_lock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12499
                                 $tmp1$$Register, $tmp2$$Register, /*tmp3*/ R0,
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 33065
diff changeset
 12500
                                 UseBiasedLocking && !UseOptoBiasInlining);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12501
    // If locking was successfull, crx should indicate 'EQ'.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12502
    // The compiler generates a branch to the runtime call to
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12503
    // _complete_monitor_locking_Java for the case where crx is 'NE'.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12504
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12505
  ins_pipe(pipe_class_compare);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12506
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12507
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12508
// Separate version for TM. Use bound register for box to enable USE_KILL.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12509
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
 12510
  match(Set crx (FastLock oop box));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12511
  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, USE_KILL box);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12512
  predicate(Compile::current()->use_rtm());
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12513
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12514
  format %{ "FASTLOCK  $oop, $box, $tmp1, $tmp2, $tmp3 (TM)" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12515
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12516
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12517
    __ compiler_fast_lock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12518
                                 $tmp1$$Register, $tmp2$$Register, $tmp3$$Register,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12519
                                 /*Biased Locking*/ false,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12520
                                 _rtm_counters, _stack_rtm_counters,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12521
                                 ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12522
                                 /*TM*/ true, ra_->C->profile_rtm());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12523
    // If locking was successfull, crx should indicate 'EQ'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12524
    // The compiler generates a branch to the runtime call to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12525
    // _complete_monitor_locking_Java for the case where crx is 'NE'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12526
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12527
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12528
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12529
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12530
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
 12531
  match(Set crx (FastUnlock oop box));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12532
  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12533
  predicate(!Compile::current()->use_rtm());
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12534
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12535
  format %{ "FASTUNLOCK  $oop, $box, $tmp1, $tmp2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12536
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12537
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12538
    __ compiler_fast_unlock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12539
                                   $tmp1$$Register, $tmp2$$Register, $tmp3$$Register,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12540
                                   UseBiasedLocking && !UseOptoBiasInlining,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12541
                                   false);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12542
    // If unlocking was successfull, crx should indicate 'EQ'.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12543
    // The compiler generates a branch to the runtime call to
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12544
    // _complete_monitor_unlocking_Java for the case where crx is 'NE'.
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12545
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12546
  ins_pipe(pipe_class_compare);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12547
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12548
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12549
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
 12550
  match(Set crx (FastUnlock oop box));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12551
  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12552
  predicate(Compile::current()->use_rtm());
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12553
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12554
  format %{ "FASTUNLOCK  $oop, $box, $tmp1, $tmp2 (TM)" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12555
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12556
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12557
    __ compiler_fast_unlock_object($crx$$CondRegister, $oop$$Register, $box$$Register,
35156
a06b3d7455d6 8145913: PPC64: add Montgomery multiply intrinsic
mdoerr
parents: 35118
diff changeset
 12558
                                   $tmp1$$Register, $tmp2$$Register, $tmp3$$Register,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 12559
                                   /*Biased Locking*/ false, /*TM*/ true);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12560
    // If unlocking was successfull, crx should indicate 'EQ'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12561
    // The compiler generates a branch to the runtime call to
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12562
    // _complete_monitor_unlocking_Java for the case where crx is 'NE'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12563
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12564
  ins_pipe(pipe_class_compare);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12565
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12566
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12567
// Align address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12568
instruct align_addr(iRegPdst dst, iRegPsrc src, immLnegpow2 mask) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12569
  match(Set dst (CastX2P (AndL (CastP2X src) mask)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12570
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12571
  format %{ "ANDDI   $dst, $src, $mask \t// next aligned address" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12572
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12573
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12574
    // TODO: PPC port $archOpcode(ppc64Opcode_rldicr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12575
    __ clrrdi($dst$$Register, $src$$Register, log2_long((jlong)-$mask$$constant));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12576
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12577
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12578
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12579
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12580
// Array size computation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12581
instruct array_size(iRegLdst dst, iRegPsrc end, iRegPsrc start) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12582
  match(Set dst (SubL (CastP2X end) (CastP2X start)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12583
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12584
  format %{ "SUB     $dst, $end, $start \t// array size in bytes" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12585
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12586
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12587
    // TODO: PPC port $archOpcode(ppc64Opcode_subf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12588
    __ subf($dst$$Register, $start$$Register, $end$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12589
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12590
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12591
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12592
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12593
// 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
 12594
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
 12595
  match(Set dummy (ClearArray cnt base));
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12596
  effect(USE_KILL base, KILL ctr);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12597
  ins_cost(2 * MEMORY_REF_COST);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12598
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12599
  format %{ "ClearArray $cnt, $base" %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12600
  ins_encode %{
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12601
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12602
    __ 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
 12603
  %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12604
  ins_pipe(pipe_class_default);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12605
%}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12606
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12607
// Clear-array with constant large array length.
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12608
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
 12609
  match(Set dummy (ClearArray cnt base));
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12610
  effect(USE_KILL base, TEMP tmp, KILL ctr);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12611
  ins_cost(3 * MEMORY_REF_COST);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12612
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12613
  format %{ "ClearArray $cnt, $base \t// KILL $tmp" %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12614
  ins_encode %{
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12615
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12616
    __ 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
 12617
  %}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12618
  ins_pipe(pipe_class_default);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12619
%}
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12620
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12621
// Clear-array with dynamic array length.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12622
instruct inlineCallClearArray(rarg1RegL cnt, rarg2RegP base, Universe dummy, regCTR ctr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12623
  match(Set dummy (ClearArray cnt base));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12624
  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
 12625
  ins_cost(4 * MEMORY_REF_COST);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12626
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12627
  format %{ "ClearArray $cnt, $base" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12628
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12629
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42619
diff changeset
 12630
    __ 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
 12631
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12632
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12633
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 12634
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12635
instruct string_compareL(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12636
                         iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12637
  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12638
  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12639
  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
 12640
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12641
  format %{ "String Compare byte[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12642
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12643
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12644
    __ string_compare($str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12645
                      $cnt1$$Register, $cnt2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12646
                      $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12647
                      $result$$Register, StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12648
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12649
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12650
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12651
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12652
instruct string_compareU(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12653
                         iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12654
  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12655
  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12656
  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
 12657
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12658
  format %{ "String Compare char[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12659
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12660
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12661
    __ string_compare($str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12662
                      $cnt1$$Register, $cnt2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12663
                      $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12664
                      $result$$Register, StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12665
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12666
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12667
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12668
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12669
instruct string_compareLU(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12670
                          iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12671
  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12672
  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12673
  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
 12674
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12675
  format %{ "String Compare byte[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12676
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12677
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12678
    __ string_compare($str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12679
                      $cnt1$$Register, $cnt2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12680
                      $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12681
                      $result$$Register, StrIntrinsicNode::LU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12682
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12683
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12684
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12685
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12686
instruct string_compareUL(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12687
                          iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12688
  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12689
  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12690
  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
 12691
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12692
  format %{ "String Compare byte[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12693
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12694
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12695
    __ string_compare($str2$$Register, $str1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12696
                      $cnt2$$Register, $cnt1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12697
                      $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12698
                      $result$$Register, StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12699
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12700
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12701
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12702
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12703
instruct string_equalsL(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12704
                        iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12705
  predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12706
  match(Set result (StrEquals (Binary str1 str2) cnt));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12707
  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
 12708
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12709
  format %{ "String Equals byte[] $str1,$str2,$cnt -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12710
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12711
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12712
    __ array_equals(false, $str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12713
                    $cnt$$Register, $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12714
                    $result$$Register, true /* byte */);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12715
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12716
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12717
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12718
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12719
instruct string_equalsU(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12720
                        iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12721
  predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12722
  match(Set result (StrEquals (Binary str1 str2) cnt));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12723
  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
 12724
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12725
  format %{ "String Equals char[]  $str1,$str2,$cnt -> $result \t// KILL $tmp" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12726
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12727
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12728
    __ array_equals(false, $str1$$Register, $str2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12729
                    $cnt$$Register, $tmp$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12730
                    $result$$Register, false /* byte */);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12731
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12732
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12733
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12734
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12735
instruct array_equalsB(rarg1RegP ary1, rarg2RegP ary2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12736
                       iRegIdst tmp1, iRegIdst tmp2, regCTR ctr, flagsRegCR0 cr0, flagsRegCR0 cr1) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12737
  predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12738
  match(Set result (AryEq ary1 ary2));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12739
  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
 12740
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12741
  format %{ "Array Equals $ary1,$ary2 -> $result \t// KILL $tmp1,$tmp2" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12742
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12743
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12744
    __ array_equals(true, $ary1$$Register, $ary2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12745
                    $tmp1$$Register, $tmp2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12746
                    $result$$Register, true /* byte */);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12747
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12748
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12749
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12750
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12751
instruct array_equalsC(rarg1RegP ary1, rarg2RegP ary2, iRegIdst result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12752
                       iRegIdst tmp1, iRegIdst tmp2, regCTR ctr, flagsRegCR0 cr0, flagsRegCR0 cr1) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12753
  predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12754
  match(Set result (AryEq ary1 ary2));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12755
  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
 12756
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12757
  format %{ "Array Equals $ary1,$ary2 -> $result \t// KILL $tmp1,$tmp2" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12758
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12759
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12760
    __ array_equals(true, $ary1$$Register, $ary2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12761
                    $tmp1$$Register, $tmp2$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12762
                    $result$$Register, false /* byte */);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12763
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12764
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12765
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12766
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12767
instruct indexOf_imm1_char_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12768
                             immP needleImm, immL offsetImm, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12769
                             iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12770
                             flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12771
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary (AddP needleImm offsetImm) needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12772
  effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12773
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12774
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12775
  ins_cost(150);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12776
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12777
  format %{ "String IndexOf CSCL1 $haystack[0..$haycnt], $needleImm+$offsetImm[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12778
            "-> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12779
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12780
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12781
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12782
    immPOper *needleOper = (immPOper *)$needleImm;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12783
    const TypeOopPtr *t = needleOper->type()->isa_oopptr();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12784
    ciTypeArray* needle_values = t->const_oop()->as_type_array();  // Pointer to live char *
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12785
    jchar chr;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12786
#ifdef VM_LITTLE_ENDIAN
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12787
    chr = (((jchar)(unsigned char)needle_values->element_value(1).as_byte()) << 8) |
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12788
           ((jchar)(unsigned char)needle_values->element_value(0).as_byte());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12789
#else
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12790
    chr = (((jchar)(unsigned char)needle_values->element_value(0).as_byte()) << 8) |
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12791
           ((jchar)(unsigned char)needle_values->element_value(1).as_byte());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12792
#endif
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12793
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12794
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12795
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12796
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12797
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12798
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12799
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12800
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12801
instruct indexOf_imm1_char_L(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12802
                             immP needleImm, immL offsetImm, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12803
                             iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12804
                             flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12805
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary (AddP needleImm offsetImm) needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12806
  effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12807
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12808
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12809
  ins_cost(150);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12810
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12811
  format %{ "String IndexOf CSCL1 $haystack[0..$haycnt], $needleImm+$offsetImm[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12812
            "-> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12813
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12814
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12815
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12816
    immPOper *needleOper = (immPOper *)$needleImm;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12817
    const TypeOopPtr *t = needleOper->type()->isa_oopptr();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12818
    ciTypeArray* needle_values = t->const_oop()->as_type_array();  // Pointer to live char *
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12819
    jchar chr = (jchar)needle_values->element_value(0).as_byte();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12820
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12821
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12822
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12823
                           $tmp1$$Register, $tmp2$$Register, true /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12824
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12825
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12826
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12827
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12828
instruct indexOf_imm1_char_UL(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12829
                              immP needleImm, immL offsetImm, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12830
                              iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12831
                              flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12832
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary (AddP needleImm offsetImm) needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12833
  effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12834
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12835
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12836
  ins_cost(150);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12837
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12838
  format %{ "String IndexOf CSCL1 $haystack[0..$haycnt], $needleImm+$offsetImm[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12839
            "-> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12840
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12841
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12842
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12843
    immPOper *needleOper = (immPOper *)$needleImm;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12844
    const TypeOopPtr *t = needleOper->type()->isa_oopptr();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12845
    ciTypeArray* needle_values = t->const_oop()->as_type_array();  // Pointer to live char *
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12846
    jchar chr = (jchar)needle_values->element_value(0).as_byte();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12847
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12848
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12849
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12850
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
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_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12853
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12854
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12855
instruct indexOf_imm1_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12856
                        rscratch2RegP needle, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12857
                        iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12858
                        flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12859
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12860
  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
 12861
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12862
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12863
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12864
            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
 12865
  ins_cost(180);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12866
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12867
  format %{ "String IndexOf SCL1 $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12868
            " -> $result \t// KILL $haycnt, $needle, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12869
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12870
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12871
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12872
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12873
    guarantee(needle_values, "sanity");
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12874
    jchar chr;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12875
#ifdef VM_LITTLE_ENDIAN
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12876
    chr = (((jchar)(unsigned char)needle_values->element_value(1).as_byte()) << 8) |
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12877
           ((jchar)(unsigned char)needle_values->element_value(0).as_byte());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12878
#else
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12879
    chr = (((jchar)(unsigned char)needle_values->element_value(0).as_byte()) << 8) |
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12880
           ((jchar)(unsigned char)needle_values->element_value(1).as_byte());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12881
#endif
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12882
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12883
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12884
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12885
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12886
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12887
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12888
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12889
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12890
instruct indexOf_imm1_L(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12891
                        rscratch2RegP needle, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12892
                        iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12893
                        flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12894
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12895
  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
 12896
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12897
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12898
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12899
            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
 12900
  ins_cost(180);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12901
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12902
  format %{ "String IndexOf SCL1 $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12903
            " -> $result \t// KILL $haycnt, $needle, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12904
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12905
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12906
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12907
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12908
    guarantee(needle_values, "sanity");
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12909
    jchar chr = (jchar)needle_values->element_value(0).as_byte();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12910
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12911
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12912
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12913
                           $tmp1$$Register, $tmp2$$Register, true /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12914
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12915
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12916
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12917
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12918
instruct indexOf_imm1_UL(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12919
                         rscratch2RegP needle, immI_1 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12920
                         iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12921
                         flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12922
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12923
  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
 12924
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12925
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12926
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12927
            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
 12928
  ins_cost(180);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12929
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12930
  format %{ "String IndexOf SCL1 $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12931
            " -> $result \t// KILL $haycnt, $needle, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12932
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12933
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12934
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12935
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12936
    guarantee(needle_values, "sanity");
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12937
    jchar chr = (jchar)needle_values->element_value(0).as_byte();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12938
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12939
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12940
                           R0, chr,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12941
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12942
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12943
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12944
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12945
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12946
instruct indexOfChar_U(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12947
                       iRegIsrc ch, iRegIdst tmp1, iRegIdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12948
                       flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12949
  match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12950
  effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12951
  ins_cost(180);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12952
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12953
  format %{ "String IndexOfChar $haystack[0..$haycnt], $ch"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12954
            " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12955
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12956
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12957
    __ string_indexof_char($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12958
                           $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12959
                           $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
 12960
                           $tmp1$$Register, $tmp2$$Register, false /*is_byte*/);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12961
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12962
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12963
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12964
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12965
instruct indexOf_imm_U(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12966
                       iRegPsrc needle, uimmI15 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12967
                       iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12968
                       flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12969
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12970
  effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12971
         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
 12972
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12973
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12974
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12975
            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
 12976
  ins_cost(250);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12977
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12978
  format %{ "String IndexOf SCL $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12979
            " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12980
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12981
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12982
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12983
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12984
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12985
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12986
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12987
                      $needle$$Register, needle_values, $tmp5$$Register, $needlecntImm$$constant,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12988
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12989
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12990
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12991
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12992
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12993
instruct indexOf_imm_L(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12994
                       iRegPsrc needle, uimmI15 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12995
                       iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12996
                       flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12997
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12998
  effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 12999
         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
 13000
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13001
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13002
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13003
            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
 13004
  ins_cost(250);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13005
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13006
  format %{ "String IndexOf SCL $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13007
            " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13008
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13009
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13010
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13011
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13012
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13013
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13014
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13015
                      $needle$$Register, needle_values, $tmp5$$Register, $needlecntImm$$constant,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13016
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13017
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13018
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13019
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13020
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13021
instruct indexOf_imm_UL(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13022
                        iRegPsrc needle, uimmI15 needlecntImm,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13023
                        iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13024
                        flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13025
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13026
  effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13027
         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
 13028
  // Required for EA: check if it is still a type_array.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13029
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13030
            n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13031
            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
 13032
  ins_cost(250);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13033
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13034
  format %{ "String IndexOf SCL $haystack[0..$haycnt], $needle[0..$needlecntImm]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13035
            " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13036
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13037
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13038
    Node *ndl = in(operand_index($needle));  // The node that defines needle.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13039
    ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13040
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13041
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13042
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13043
                      $needle$$Register, needle_values, $tmp5$$Register, $needlecntImm$$constant,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13044
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13045
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13046
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13047
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13048
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13049
instruct indexOf_U(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt, iRegPsrc needle, rscratch2RegI needlecnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13050
                   iRegLdst tmp1, iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13051
                   flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13052
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13053
  effect(USE_KILL haycnt, USE_KILL needlecnt, /*better: TDEF haycnt, TDEF needlecnt,*/
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13054
         TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13055
         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
 13056
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13057
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13058
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13059
  format %{ "String IndexOf $haystack[0..$haycnt], $needle[0..$needlecnt]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13060
             " -> $result \t// KILL $haycnt, $needlecnt, $tmp1, $tmp2, $tmp3, $tmp4, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13061
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13062
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13063
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13064
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13065
                      $needle$$Register, NULL, $needlecnt$$Register, 0,  // needlecnt not constant.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13066
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::UU);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13067
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13068
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13069
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13070
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13071
instruct indexOf_L(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt, iRegPsrc needle, rscratch2RegI needlecnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13072
                   iRegLdst tmp1, iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13073
                   flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13074
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13075
  effect(USE_KILL haycnt, USE_KILL needlecnt, /*better: TDEF haycnt, TDEF needlecnt,*/
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13076
         TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13077
         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
 13078
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13079
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13080
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13081
  format %{ "String IndexOf $haystack[0..$haycnt], $needle[0..$needlecnt]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13082
             " -> $result \t// KILL $haycnt, $needlecnt, $tmp1, $tmp2, $tmp3, $tmp4, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13083
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13084
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13085
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13086
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13087
                      $needle$$Register, NULL, $needlecnt$$Register, 0,  // needlecnt not constant.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13088
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::LL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13089
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13090
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13091
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13092
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13093
instruct indexOf_UL(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt, iRegPsrc needle, rscratch2RegI needlecnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13094
                    iRegLdst tmp1, iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13095
                    flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13096
  match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13097
  effect(USE_KILL haycnt, USE_KILL needlecnt, /*better: TDEF haycnt, TDEF needlecnt,*/
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13098
         TEMP_DEF result,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13099
         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
 13100
  predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13101
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13102
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13103
  format %{ "String IndexOf $haystack[0..$haycnt], $needle[0..$needlecnt]"
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13104
             " -> $result \t// KILL $haycnt, $needlecnt, $tmp1, $tmp2, $tmp3, $tmp4, $cr0, $cr1" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13105
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13106
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13107
    __ string_indexof($result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13108
                      $haystack$$Register, $haycnt$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13109
                      $needle$$Register, NULL, $needlecnt$$Register, 0,  // needlecnt not constant.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13110
                      $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, StrIntrinsicNode::UL);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13111
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13112
  ins_pipe(pipe_class_compare);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13113
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13114
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13115
// char[] to byte[] compression
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13116
instruct string_compress(rarg1RegP src, rarg2RegP dst, iRegIsrc len, iRegIdst result, iRegLdst tmp1,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13117
                         iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4, iRegLdst tmp5, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13118
  match(Set result (StrCompressedCopy src (Binary dst len)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13119
  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
 13120
         USE_KILL src, USE_KILL dst, KILL ctr, KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13121
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13122
  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
 13123
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13124
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13125
    Label Lskip, Ldone;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13126
    __ li($result$$Register, 0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13127
    __ string_compress_16($src$$Register, $dst$$Register, $len$$Register, $tmp1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13128
                          $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, $tmp5$$Register, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13129
    __ rldicl_($tmp1$$Register, $len$$Register, 0, 64-3); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13130
    __ beq(CCR0, Lskip);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13131
    __ string_compress($src$$Register, $dst$$Register, $tmp1$$Register, $tmp2$$Register, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13132
    __ bind(Lskip);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13133
    __ mr($result$$Register, $len$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13134
    __ bind(Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13135
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13136
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13137
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13138
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13139
// byte[] to char[] inflation
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13140
instruct string_inflate(Universe dummy, rarg1RegP src, rarg2RegP dst, iRegIsrc len, iRegLdst tmp1,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13141
                        iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4, iRegLdst tmp5, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13142
  match(Set dummy (StrInflatedCopy src (Binary dst len)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13143
  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
 13144
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13145
  format %{ "String Inflate $src,$dst,$len \t// KILL $tmp1, $tmp2, $tmp3, $tmp4, $tmp5" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13146
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13147
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13148
    Label Ldone;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13149
    __ string_inflate_16($src$$Register, $dst$$Register, $len$$Register, $tmp1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13150
                         $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, $tmp5$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13151
    __ rldicl_($tmp1$$Register, $len$$Register, 0, 64-3); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13152
    __ beq(CCR0, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13153
    __ string_inflate($src$$Register, $dst$$Register, $tmp1$$Register, $tmp2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13154
    __ bind(Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13155
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13156
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13157
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13158
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13159
// StringCoding.java intrinsics
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13160
instruct has_negatives(rarg1RegP ary1, iRegIsrc len, iRegIdst result, iRegLdst tmp1, iRegLdst tmp2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13161
                       regCTR ctr, flagsRegCR0 cr0)
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13162
%{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13163
  match(Set result (HasNegatives ary1 len));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13164
  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
 13165
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13166
  format %{ "has negatives byte[] $ary1,$len -> $result \t// KILL $tmp1, $tmp2" %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13167
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13168
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13169
    __ has_negatives($ary1$$Register, $len$$Register, $result$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13170
                     $tmp1$$Register, $tmp2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13171
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13172
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13173
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13174
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13175
// encode char[] to byte[] in ISO_8859_1
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13176
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
 13177
                          iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4, iRegLdst tmp5, regCTR ctr, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13178
  match(Set result (EncodeISOArray src (Binary dst len)));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13179
  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
 13180
         USE_KILL src, USE_KILL dst, KILL ctr, KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13181
  ins_cost(300);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13182
  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
 13183
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13184
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13185
    Label Lslow, Lfailure1, Lfailure2, Ldone;
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13186
    __ string_compress_16($src$$Register, $dst$$Register, $len$$Register, $tmp1$$Register,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13187
                          $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, $tmp5$$Register, Lfailure1);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13188
    __ rldicl_($result$$Register, $len$$Register, 0, 64-3); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13189
    __ beq(CCR0, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13190
    __ bind(Lslow);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13191
    __ string_compress($src$$Register, $dst$$Register, $result$$Register, $tmp2$$Register, Lfailure2);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13192
    __ li($result$$Register, 0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13193
    __ b(Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13194
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13195
    __ bind(Lfailure1);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13196
    __ mr($result$$Register, $len$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13197
    __ mfctr($tmp1$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13198
    __ rldimi_($result$$Register, $tmp1$$Register, 3, 0); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13199
    __ beq(CCR0, Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13200
    __ b(Lslow);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13201
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13202
    __ bind(Lfailure2);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13203
    __ mfctr($result$$Register); // Remaining characters.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13204
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13205
    __ bind(Ldone);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13206
    __ subf($result$$Register, $result$$Register, $len$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13207
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13208
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13209
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13210
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13211
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13212
//---------- Min/Max Instructions ---------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13213
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13214
instruct minI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13215
  match(Set dst (MinI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13216
  ins_cost(DEFAULT_COST*6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13217
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13218
  expand %{
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13219
    iRegLdst src1s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13220
    iRegLdst src2s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13221
    iRegLdst diff;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13222
    iRegLdst sm;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13223
    iRegLdst doz; // difference or zero
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13224
    convI2L_reg(src1s, src1); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13225
    convI2L_reg(src2s, src2); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13226
    subL_reg_reg(diff, src2s, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13227
    // Need to consider >=33 bit result, therefore we need signmaskL.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13228
    signmask64L_regL(sm, diff);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13229
    andL_reg_reg(doz, diff, sm); // <=0
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13230
    addI_regL_regL(dst, doz, src1s);
22861
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13233
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13234
instruct minI_reg_reg_isel(iRegIdst dst, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13235
  match(Set dst (MinI src1 src2));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13236
  effect(KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13237
  predicate(VM_Version::has_isel());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13238
  ins_cost(DEFAULT_COST*2);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13239
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13240
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13241
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13242
    __ cmpw(CCR0, $src1$$Register, $src2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13243
    __ isel($dst$$Register, CCR0, Assembler::less, /*invert*/false, $src1$$Register, $src2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13244
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13245
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13246
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13247
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13248
instruct maxI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13249
  match(Set dst (MaxI src1 src2));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13250
  ins_cost(DEFAULT_COST*6);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13251
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13252
  expand %{
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13253
    iRegLdst src1s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13254
    iRegLdst src2s;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13255
    iRegLdst diff;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13256
    iRegLdst sm;
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13257
    iRegLdst doz; // difference or zero
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13258
    convI2L_reg(src1s, src1); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13259
    convI2L_reg(src2s, src2); // Ensure proper sign extension.
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13260
    subL_reg_reg(diff, src2s, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13261
    // Need to consider >=33 bit result, therefore we need signmaskL.
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13262
    signmask64L_regL(sm, diff);
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13263
    andcL_reg_reg(doz, diff, sm); // >=0
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 24018
diff changeset
 13264
    addI_regL_regL(dst, doz, src1s);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13265
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13266
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13267
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13268
instruct maxI_reg_reg_isel(iRegIdst dst, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13269
  match(Set dst (MaxI src1 src2));
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13270
  effect(KILL cr0);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13271
  predicate(VM_Version::has_isel());
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13272
  ins_cost(DEFAULT_COST*2);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13273
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13274
  ins_encode %{
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13275
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13276
    __ cmpw(CCR0, $src1$$Register, $src2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13277
    __ isel($dst$$Register, CCR0, Assembler::greater, /*invert*/false, $src1$$Register, $src2$$Register);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13278
  %}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13279
  ins_pipe(pipe_class_default);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13280
%}
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35913
diff changeset
 13281
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13282
//---------- Population Count Instructions ------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13283
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13284
// Popcnt for Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13285
instruct popCountI(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13286
  match(Set dst (PopCountI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13287
  predicate(UsePopCountInstruction && VM_Version::has_popcntw());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13288
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13289
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13290
  format %{ "POPCNTW $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13291
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13292
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13293
    // TODO: PPC port $archOpcode(ppc64Opcode_popcntb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13294
    __ popcntw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13295
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13296
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13299
// Popcnt for Power7.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13300
instruct popCountL(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13301
  predicate(UsePopCountInstruction && VM_Version::has_popcntw());
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13302
  match(Set dst (PopCountL src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13303
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13304
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13305
  format %{ "POPCNTD $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13306
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13307
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13308
    // TODO: PPC port $archOpcode(ppc64Opcode_popcntb);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13309
    __ popcntd($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13310
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13311
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13312
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13313
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13314
instruct countLeadingZerosI(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13315
  match(Set dst (CountLeadingZerosI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13316
  predicate(UseCountLeadingZerosInstructionsPPC64);  // See Matcher::match_rule_supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13317
  ins_cost(DEFAULT_COST);
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
  format %{ "CNTLZW  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13320
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13321
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13322
    // TODO: PPC port $archOpcode(ppc64Opcode_cntlzw);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13323
    __ cntlzw($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13324
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13325
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13326
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13327
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13328
instruct countLeadingZerosL(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13329
  match(Set dst (CountLeadingZerosL src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13330
  predicate(UseCountLeadingZerosInstructionsPPC64);  // See Matcher::match_rule_supported.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13331
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13332
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13333
  format %{ "CNTLZD  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13334
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13335
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13336
    // TODO: PPC port $archOpcode(ppc64Opcode_cntlzd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13337
    __ cntlzd($dst$$Register, $src$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13338
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13339
  ins_pipe(pipe_class_default);
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 countLeadingZerosP(iRegIdst dst, iRegPsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13343
  // no match-rule, false predicate
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13344
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13345
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13346
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13347
  format %{ "CNTLZD  $dst, $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13348
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13349
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13350
    // TODO: PPC port $archOpcode(ppc64Opcode_cntlzd);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13351
    __ cntlzd($dst$$Register, $src$$Register);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13354
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13355
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13356
instruct countTrailingZerosI_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13357
  match(Set dst (CountTrailingZerosI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13358
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13359
  ins_cost(DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13360
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13361
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13362
    immI16 imm1 %{ (int)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13363
    immI16 imm2 %{ (int)32 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13364
    immI_minus1 m1 %{ -1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13365
    iRegIdst tmpI1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13366
    iRegIdst tmpI2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13367
    iRegIdst tmpI3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13368
    addI_reg_imm16(tmpI1, src, imm1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13369
    andcI_reg_reg(tmpI2, src, m1, tmpI1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13370
    countLeadingZerosI(tmpI3, tmpI2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13371
    subI_imm16_reg(dst, imm2, tmpI3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13372
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13373
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13374
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13375
instruct countTrailingZerosL_Ex(iRegIdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13376
  match(Set dst (CountTrailingZerosL src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13377
  predicate(UseCountLeadingZerosInstructionsPPC64);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13378
  ins_cost(DEFAULT_COST);
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
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13381
    immL16 imm1 %{ (long)-1 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13382
    immI16 imm2 %{ (int)64 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13383
    iRegLdst tmpL1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13384
    iRegLdst tmpL2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13385
    iRegIdst tmpL3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13386
    addL_reg_imm16(tmpL1, src, imm1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13387
    andcL_reg_reg(tmpL2, tmpL1, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13388
    countLeadingZerosL(tmpL3, tmpL2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13389
    subI_imm16_reg(dst, imm2, tmpL3);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13392
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13393
// Expand nodes for byte_reverse_int.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13394
instruct insrwi_a(iRegIdst dst, iRegIsrc src, immI16 pos, immI16 shift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13395
  effect(DEF dst, USE src, USE pos, USE shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13396
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13397
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13398
  format %{ "INSRWI  $dst, $src, $pos, $shift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13399
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13400
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13401
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13402
    __ insrwi($dst$$Register, $src$$Register, $shift$$constant, $pos$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13403
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13404
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13405
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13406
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13407
// As insrwi_a, but with USE_DEF.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13408
instruct insrwi(iRegIdst dst, iRegIsrc src, immI16 pos, immI16 shift) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13409
  effect(USE_DEF dst, USE src, USE pos, USE shift);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13410
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13411
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13412
  format %{ "INSRWI  $dst, $src, $pos, $shift" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13413
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13414
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13415
    // TODO: PPC port $archOpcode(ppc64Opcode_rlwimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13416
    __ insrwi($dst$$Register, $src$$Register, $shift$$constant, $pos$$constant);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13417
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13418
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13419
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13420
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13421
// Just slightly faster than java implementation.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13422
instruct bytes_reverse_int_Ex(iRegIdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13423
  match(Set dst (ReverseBytesI src));
46521
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13424
  ins_cost(7*DEFAULT_COST);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13425
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13426
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13427
    immI16 imm24 %{ (int) 24 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13428
    immI16 imm16 %{ (int) 16 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13429
    immI16  imm8 %{ (int)  8 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13430
    immI16  imm4 %{ (int)  4 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13431
    immI16  imm0 %{ (int)  0 %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13432
    iRegLdst tmpI1;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13433
    iRegLdst tmpI2;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13434
    iRegLdst tmpI3;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13435
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13436
    urShiftI_reg_imm(tmpI1, src, imm24);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13437
    insrwi_a(dst, tmpI1, imm24, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13438
    urShiftI_reg_imm(tmpI2, src, imm16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13439
    insrwi(dst, tmpI2, imm8, imm16);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13440
    urShiftI_reg_imm(tmpI3, src, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13441
    insrwi(dst, tmpI3, imm8, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13442
    insrwi(dst, src, imm0, imm8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13443
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13444
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13445
46521
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13446
instruct bytes_reverse_long_Ex(iRegLdst dst, iRegLsrc src) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13447
  match(Set dst (ReverseBytesL src));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13448
  ins_cost(15*DEFAULT_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13449
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13450
  expand %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13451
    immI16 imm56 %{ (int) 56 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13452
    immI16 imm48 %{ (int) 48 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13453
    immI16 imm40 %{ (int) 40 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13454
    immI16 imm32 %{ (int) 32 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13455
    immI16 imm24 %{ (int) 24 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13456
    immI16 imm16 %{ (int) 16 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13457
    immI16  imm8 %{ (int)  8 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13458
    immI16  imm0 %{ (int)  0 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13459
    iRegLdst tmpL1;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13460
    iRegLdst tmpL2;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13461
    iRegLdst tmpL3;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13462
    iRegLdst tmpL4;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13463
    iRegLdst tmpL5;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13464
    iRegLdst tmpL6;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13465
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13466
                                        // src   : |a|b|c|d|e|f|g|h|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13467
    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
 13468
    rldicl(tmpL2, tmpL1, imm32, imm24); // tmpL2 : | | | |a| | | |e|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13469
    rldicl(tmpL3, tmpL2, imm32, imm0);  // tmpL3 : | | | |e| | | |a|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13470
    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
 13471
    rldicl(tmpL2, tmpL1, imm32, imm24); // tmpL2 : | | | |b| | | |f|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13472
    rldicl(tmpL4, tmpL2, imm40, imm0);  // tmpL4 : | | |f| | | |b| |
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13473
    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
 13474
    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
 13475
    rldicl(tmpL2, tmpL1, imm32, imm24); // tmpL2 : | | | |c| | | |g|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13476
    rldicl(tmpL3, tmpL2, imm48, imm0);  // tmpL3 : | |g| | | |c| | |
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13477
    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
 13478
    rldicl(tmpL2, tmpL1, imm32, imm24); // tmpL2 : | | | |d| | | |h|
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13479
    rldicl(tmpL4, tmpL2, imm56, imm0);  // tmpL4 : |h| | | |d| | | |
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13480
    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
 13481
    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
 13482
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13483
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13484
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13485
instruct bytes_reverse_ushort_Ex(iRegIdst dst, iRegIsrc src) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13486
  match(Set dst (ReverseBytesUS src));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13487
  ins_cost(2*DEFAULT_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13488
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13489
  expand %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13490
    immI16  imm16 %{ (int) 16 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13491
    immI16   imm8 %{ (int)  8 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13492
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13493
    urShiftI_reg_imm(dst, src, imm8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13494
    insrwi(dst, src, imm16, imm8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13495
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13496
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13497
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13498
instruct bytes_reverse_short_Ex(iRegIdst dst, iRegIsrc src) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13499
  match(Set dst (ReverseBytesS src));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13500
  ins_cost(3*DEFAULT_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13501
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13502
  expand %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13503
    immI16  imm16 %{ (int) 16 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13504
    immI16   imm8 %{ (int)  8 %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13505
    iRegLdst tmpI1;
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13506
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13507
    urShiftI_reg_imm(tmpI1, src, imm8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13508
    insrwi(tmpI1, src, imm16, imm8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13509
    extsh(dst, tmpI1);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13510
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13511
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13512
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13513
// Load Integer reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13514
instruct loadI_reversed(iRegIdst dst, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13515
  match(Set dst (ReverseBytesI (LoadI mem)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13516
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13517
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13518
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13519
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13520
    __ lwbrx($dst$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13521
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13522
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13523
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13524
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13525
// Load Long - aligned and reversed
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13526
instruct loadL_reversed(iRegLdst dst, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13527
  match(Set dst (ReverseBytesL (LoadL mem)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13528
  predicate(VM_Version::has_ldbrx());
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13529
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13530
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13531
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13532
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13533
    __ ldbrx($dst$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13534
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13535
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13536
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13537
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13538
// Load unsigned short / char reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13539
instruct loadUS_reversed(iRegIdst dst, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13540
  match(Set dst (ReverseBytesUS (LoadUS mem)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13541
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13542
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13543
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13544
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13545
    __ lhbrx($dst$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13546
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13547
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13548
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13549
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13550
// Load short reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13551
instruct loadS_reversed(iRegIdst dst, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13552
  match(Set dst (ReverseBytesS (LoadS mem)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13553
  ins_cost(MEMORY_REF_COST + DEFAULT_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13554
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13555
  size(8);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13556
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13557
    __ lhbrx($dst$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13558
    __ extsh($dst$$Register, $dst$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13559
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13560
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13561
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13562
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13563
// Store Integer reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13564
instruct storeI_reversed(iRegIsrc src, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13565
  match(Set mem (StoreI mem (ReverseBytesI src)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13566
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13567
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13568
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13569
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13570
    __ stwbrx($src$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13571
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13572
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13573
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13574
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13575
// Store Long reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13576
instruct storeL_reversed(iRegLsrc src, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13577
  match(Set mem (StoreL mem (ReverseBytesL src)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13578
  predicate(VM_Version::has_stdbrx());
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13579
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13580
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13581
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13582
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13583
    __ stdbrx($src$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13584
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13585
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13586
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13587
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13588
// Store unsigned short / char reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13589
instruct storeUS_reversed(iRegIsrc src, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13590
  match(Set mem (StoreC mem (ReverseBytesUS src)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13591
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13592
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13593
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13594
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13595
    __ sthbrx($src$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13596
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13597
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13598
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13599
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13600
// Store short reversed byte order
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13601
instruct storeS_reversed(iRegIsrc src, indirect mem) %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13602
  match(Set mem (StoreC mem (ReverseBytesS src)));
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13603
  ins_cost(MEMORY_REF_COST);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13604
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13605
  size(4);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13606
  ins_encode %{
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13607
    __ sthbrx($src$$Register, $mem$$Register);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13608
  %}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13609
  ins_pipe(pipe_class_default);
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13610
%}
17e8acfe1db8 8179527: Implement intrinsic code for reverseBytes with load/store
mdoerr
parents: 46378
diff changeset
 13611
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13612
instruct mtvsrwz(vecX temp1, iRegIsrc src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13613
  effect(DEF temp1, USE src);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13614
  
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13615
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13616
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13617
    __ mtvsrwz($temp1$$VectorSRegister, $src$$Register);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13618
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13619
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13620
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13621
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13622
instruct xxspltw(vecX dst, vecX src, immI8 imm1) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13623
  effect(DEF dst, USE src, USE imm1);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13624
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13625
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13626
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13627
    __ xxspltw($dst$$VectorSRegister, $src$$VectorSRegister, $imm1$$constant); 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13628
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13629
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13630
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13631
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13632
//---------- Replicate Vector Instructions ------------------------------------
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
// Insrdi does replicate if src == dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13635
instruct repl32(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13636
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13637
  effect(USE_DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13638
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13639
  format %{ "INSRDI  $dst, #0, $dst, #32 \t// replicate" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13640
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13641
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13642
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13643
    __ insrdi($dst$$Register, $dst$$Register, 32, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13644
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13645
  ins_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13648
// Insrdi does replicate if src == dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13649
instruct repl48(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13650
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13651
  effect(USE_DEF dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13652
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13653
  format %{ "INSRDI  $dst, #0, $dst, #48 \t// replicate" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13654
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13655
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13656
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13657
    __ insrdi($dst$$Register, $dst$$Register, 48, 0);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13660
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13661
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13662
// Insrdi does replicate if src == dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13663
instruct repl56(iRegLdst dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13664
  predicate(false);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13665
  effect(USE_DEF dst);
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
  format %{ "INSRDI  $dst, #0, $dst, #56 \t// replicate" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13668
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13669
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13670
    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13671
    __ insrdi($dst$$Register, $dst$$Register, 56, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13672
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13673
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13674
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13675
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13676
instruct repl8B_reg_Ex(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13677
  match(Set dst (ReplicateB src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13678
  predicate(n->as_Vector()->length() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13679
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13680
    moveReg(dst, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13681
    repl56(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13682
    repl48(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13683
    repl32(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13684
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13685
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13686
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13687
instruct repl8B_immI0(iRegLdst dst, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13688
  match(Set dst (ReplicateB zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13689
  predicate(n->as_Vector()->length() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13690
  format %{ "LI      $dst, #0 \t// replicate8B" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13691
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13692
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13693
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13694
    __ li($dst$$Register, (int)((short)($zero$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13695
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13696
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13697
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13698
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13699
instruct repl8B_immIminus1(iRegLdst dst, immI_minus1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13700
  match(Set dst (ReplicateB src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13701
  predicate(n->as_Vector()->length() == 8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13702
  format %{ "LI      $dst, #-1 \t// replicate8B" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13703
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13704
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13705
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13706
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13707
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13708
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13709
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13710
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13711
instruct repl16B_reg_Ex(vecX dst, iRegIsrc src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13712
  match(Set dst (ReplicateB src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13713
  predicate(n->as_Vector()->length() == 16);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13714
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13715
  expand %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13716
    iRegLdst tmpL;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13717
    vecX tmpV;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13718
    immI8  imm1 %{ (int)  1 %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13719
    moveReg(tmpL, src);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13720
    repl56(tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13721
    repl48(tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13722
    mtvsrwz(tmpV, tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13723
    xxspltw(dst, tmpV, imm1);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13724
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13725
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13726
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13727
instruct repl16B_immI0(vecX dst, immI_0 zero) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13728
  match(Set dst (ReplicateB zero));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13729
  predicate(n->as_Vector()->length() == 16);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13730
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13731
  format %{ "XXLXOR      $dst, $zero \t// replicate16B" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13732
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13733
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13734
    __ xxlxor($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13735
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13736
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13737
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13738
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13739
instruct repl16B_immIminus1(vecX dst, immI_minus1 src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13740
  match(Set dst (ReplicateB src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13741
  predicate(n->as_Vector()->length() == 16);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13742
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13743
  format %{ "XXLEQV      $dst, $src \t// replicate16B" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13744
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13745
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13746
    __ xxleqv($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13747
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13748
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13749
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13750
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13751
instruct repl4S_reg_Ex(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13752
  match(Set dst (ReplicateS src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13753
  predicate(n->as_Vector()->length() == 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13754
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13755
    moveReg(dst, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13756
    repl48(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13757
    repl32(dst);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13758
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13759
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13760
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13761
instruct repl4S_immI0(iRegLdst dst, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13762
  match(Set dst (ReplicateS zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13763
  predicate(n->as_Vector()->length() == 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13764
  format %{ "LI      $dst, #0 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13765
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13766
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13767
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13768
    __ li($dst$$Register, (int)((short)($zero$$constant & 0xFFFF)));
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_pipe(pipe_class_default);
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13773
instruct repl4S_immIminus1(iRegLdst dst, immI_minus1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13774
  match(Set dst (ReplicateS src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13775
  predicate(n->as_Vector()->length() == 4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13776
  format %{ "LI      $dst, -1 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13777
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13778
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13779
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13780
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13781
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13782
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13783
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13784
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13785
instruct repl8S_reg_Ex(vecX dst, iRegIsrc src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13786
  match(Set dst (ReplicateS src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13787
  predicate(n->as_Vector()->length() == 8);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13788
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13789
  expand %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13790
    iRegLdst tmpL;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13791
    vecX tmpV;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13792
    immI8  zero %{ (int)  0 %} 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13793
    moveReg(tmpL, src);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13794
    repl48(tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13795
    repl32(tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13796
    mtvsrd(tmpV, tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13797
    xxpermdi(dst, tmpV, tmpV, zero);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13798
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13799
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13800
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13801
instruct repl8S_immI0(vecX dst, immI_0 zero) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13802
  match(Set dst (ReplicateS zero));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13803
  predicate(n->as_Vector()->length() == 8);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13804
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13805
  format %{ "XXLXOR      $dst, $zero \t// replicate8S" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13806
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13807
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13808
    __ xxlxor($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13809
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13810
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13811
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13812
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13813
instruct repl8S_immIminus1(vecX dst, immI_minus1 src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13814
  match(Set dst (ReplicateS src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13815
  predicate(n->as_Vector()->length() == 8);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13816
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13817
  format %{ "XXLEQV      $dst, $src \t// replicate16B" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13818
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13819
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13820
    __ xxleqv($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13821
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13822
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13823
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13824
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13825
instruct repl2I_reg_Ex(iRegLdst dst, iRegIsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13826
  match(Set dst (ReplicateI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13827
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13828
  ins_cost(2 * DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13829
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13830
    moveReg(dst, src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13831
    repl32(dst);
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
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13834
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13835
instruct repl2I_immI0(iRegLdst dst, immI_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13836
  match(Set dst (ReplicateI zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13837
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13838
  format %{ "LI      $dst, #0 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13839
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13840
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13841
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13842
    __ li($dst$$Register, (int)((short)($zero$$constant & 0xFFFF)));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13843
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13844
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13845
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13846
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13847
instruct repl2I_immIminus1(iRegLdst dst, immI_minus1 src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13848
  match(Set dst (ReplicateI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13849
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13850
  format %{ "LI      $dst, -1 \t// replicate4C" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13851
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13852
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13853
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13854
    __ li($dst$$Register, (int)((short)($src$$constant & 0xFFFF)));
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13857
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13858
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13859
instruct repl4I_reg_Ex(vecX dst, iRegIsrc src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13860
  match(Set dst (ReplicateI src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13861
  predicate(n->as_Vector()->length() == 4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13862
  ins_cost(2 * DEFAULT_COST);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13863
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13864
  expand %{ 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13865
    iRegLdst tmpL;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13866
    vecX tmpV;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13867
    immI8  zero %{ (int)  0 %} 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13868
    moveReg(tmpL, src);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13869
    repl32(tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13870
    mtvsrd(tmpV, tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13871
    xxpermdi(dst, tmpV, tmpV, zero);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13872
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13873
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13874
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13875
instruct repl4I_immI0(vecX dst, immI_0 zero) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13876
  match(Set dst (ReplicateI zero));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13877
  predicate(n->as_Vector()->length() == 4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13878
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13879
  format %{ "XXLXOR      $dst, $zero \t// replicate4I" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13880
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13881
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13882
    __ xxlxor($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13883
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13884
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13885
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13886
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13887
instruct repl4I_immIminus1(vecX dst, immI_minus1 src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13888
  match(Set dst (ReplicateI src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13889
  predicate(n->as_Vector()->length() == 4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13890
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13891
  format %{ "XXLEQV      $dst, $dst, $dst \t// replicate4I" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13892
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13893
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13894
    __ xxleqv($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13895
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13896
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13897
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13898
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13899
// Move float to int register via stack, replicate.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13900
instruct repl2F_reg_Ex(iRegLdst dst, regF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13901
  match(Set dst (ReplicateF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13902
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13903
  ins_cost(2 * MEMORY_REF_COST + DEFAULT_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13904
  expand %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13905
    stackSlotL tmpS;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13906
    iRegIdst tmpI;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13907
    moveF2I_reg_stack(tmpS, src);   // Move float to stack.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13908
    moveF2I_stack_reg(tmpI, tmpS);  // Move stack to int reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13909
    moveReg(dst, tmpI);             // Move int to long reg.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13910
    repl32(dst);                    // Replicate bitpattern.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13911
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13912
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13913
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13914
// Replicate scalar constant to packed float values in Double register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13915
instruct repl2F_immF_Ex(iRegLdst dst, immF src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13916
  match(Set dst (ReplicateF src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13917
  predicate(n->as_Vector()->length() == 2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13918
  ins_cost(5 * DEFAULT_COST);
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
  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
 13921
  postalloc_expand( postalloc_expand_load_replF_constant(dst, src, constanttablebase) );
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
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13924
// Replicate scalar zero constant to packed float values in Double register
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13925
instruct repl2F_immF0(iRegLdst dst, immF_0 zero) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13926
  match(Set dst (ReplicateF zero));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13927
  predicate(n->as_Vector()->length() == 2);
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
  format %{ "LI      $dst, #0 \t// replicate2F" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13930
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13931
    // TODO: PPC port $archOpcode(ppc64Opcode_addi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13932
    __ li($dst$$Register, 0x0);
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
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13935
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 13936
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13937
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13938
//----------Overflow Math Instructions-----------------------------------------
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13939
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13940
// 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
 13941
// 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
 13942
// 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
 13943
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13944
instruct overflowAddL_reg_reg(flagsRegCR0 cr0, iRegLsrc op1, iRegLsrc op2) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13945
  match(Set cr0 (OverflowAddL op1 op2));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13946
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13947
  format %{ "add_    $op1, $op2\t# overflow check long" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13948
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13949
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13950
    __ li(R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13951
    __ mtxer(R0); // clear XER.SO
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13952
    __ addo_(R0, $op1$$Register, $op2$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13953
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13954
  ins_pipe(pipe_class_default);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13955
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13956
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13957
instruct overflowSubL_reg_reg(flagsRegCR0 cr0, iRegLsrc op1, iRegLsrc op2) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13958
  match(Set cr0 (OverflowSubL op1 op2));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13959
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13960
  format %{ "subfo_  R0, $op2, $op1\t# overflow check long" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13961
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13962
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13963
    __ li(R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13964
    __ mtxer(R0); // clear XER.SO
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13965
    __ subfo_(R0, $op2$$Register, $op1$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13966
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13967
  ins_pipe(pipe_class_default);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13968
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13969
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13970
instruct overflowNegL_reg(flagsRegCR0 cr0, immL_0 zero, iRegLsrc op2) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13971
  match(Set cr0 (OverflowSubL zero op2));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13972
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13973
  format %{ "nego_   R0, $op2\t# overflow check long" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13974
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13975
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13976
    __ li(R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13977
    __ mtxer(R0); // clear XER.SO
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13978
    __ nego_(R0, $op2$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13979
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13980
  ins_pipe(pipe_class_default);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13981
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13982
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13983
instruct overflowMulL_reg_reg(flagsRegCR0 cr0, iRegLsrc op1, iRegLsrc op2) %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13984
  match(Set cr0 (OverflowMulL op1 op2));
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13985
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13986
  format %{ "mulldo_ R0, $op1, $op2\t# overflow check long" %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13987
  ins_encode %{
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13988
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13989
    __ li(R0, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13990
    __ mtxer(R0); // clear XER.SO
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13991
    __ mulldo_(R0, $op1$$Register, $op2$$Register);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13992
  %}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13993
  ins_pipe(pipe_class_default);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13994
%}
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13995
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29581
diff changeset
 13996
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13997
instruct repl4F_reg_Ex(vecX dst, regF src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13998
  match(Set dst (ReplicateF src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 13999
  predicate(n->as_Vector()->length() == 4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14000
  ins_cost(2 * MEMORY_REF_COST + DEFAULT_COST);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14001
  expand %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14002
    stackSlotL tmpS;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14003
    iRegIdst tmpI;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14004
    iRegLdst tmpL;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14005
    vecX tmpV;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14006
    immI8  zero %{ (int)  0 %} 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14007
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14008
    moveF2I_reg_stack(tmpS, src);   // Move float to stack.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14009
    moveF2I_stack_reg(tmpI, tmpS);  // Move stack to int reg.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14010
    moveReg(tmpL, tmpI);             // Move int to long reg.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14011
    repl32(tmpL);                    // Replicate bitpattern.
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14012
    mtvsrd(tmpV, tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14013
    xxpermdi(dst, tmpV, tmpV, zero);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14014
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14015
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14016
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14017
instruct repl4F_immF_Ex(vecX dst, immF src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14018
  match(Set dst (ReplicateF src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14019
  predicate(n->as_Vector()->length() == 4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14020
  ins_cost(10 * DEFAULT_COST);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14021
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14022
  postalloc_expand( postalloc_expand_load_replF_constant_vsx(dst, src, constanttablebase) );
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14023
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14024
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14025
instruct repl4F_immF0(vecX dst, immF_0 zero) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14026
  match(Set dst (ReplicateF zero));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14027
  predicate(n->as_Vector()->length() == 4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14028
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14029
  format %{ "XXLXOR      $dst, $zero \t// replicate4F" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14030
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14031
    __ xxlxor($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14032
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14033
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14034
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14035
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14036
instruct repl2D_reg_Ex(vecX dst, regD src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14037
  match(Set dst (ReplicateD src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14038
  predicate(n->as_Vector()->length() == 2);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14039
  expand %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14040
    stackSlotL tmpS;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14041
    iRegLdst tmpL;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14042
    iRegLdst tmp;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14043
    vecX tmpV;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14044
    immI8  zero %{ (int)  0 %} 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14045
    moveD2L_reg_stack(tmpS, src);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14046
    moveD2L_stack_reg(tmpL, tmpS);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14047
    mtvsrd(tmpV, tmpL);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14048
    xxpermdi(dst, tmpV, tmpV, zero);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14049
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14050
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14051
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14052
instruct repl2D_immI0(vecX dst, immI_0 zero) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14053
  match(Set dst (ReplicateD zero));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14054
  predicate(n->as_Vector()->length() == 2);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14055
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14056
  format %{ "XXLXOR      $dst, $zero \t// replicate2D" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14057
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14058
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14059
    __ xxlxor($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14060
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14061
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14062
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14063
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14064
instruct repl2D_immIminus1(vecX dst, immI_minus1 src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14065
  match(Set dst (ReplicateD src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14066
  predicate(n->as_Vector()->length() == 2);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14067
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14068
  format %{ "XXLEQV      $dst, $src \t// replicate16B" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14069
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14070
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14071
    __ xxleqv($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14072
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14073
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14074
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14075
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14076
instruct mtvsrd(vecX dst, iRegLsrc src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14077
  predicate(false);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14078
  effect(DEF dst, USE src);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14079
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14080
  format %{ "MTVSRD      $dst, $src \t// Move to 16-byte register"%} 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14081
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14082
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14083
    __ mtvsrd($dst$$VectorSRegister, $src$$Register);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14084
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14085
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14086
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14087
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14088
instruct xxspltd(vecX dst, vecX src, immI8 zero) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14089
  effect(DEF dst, USE src, USE zero);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14090
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14091
  format %{ "XXSPLATD      $dst, $src, $zero \t// Permute 16-byte register"%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14092
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14093
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14094
    __ xxpermdi($dst$$VectorSRegister, $src$$VectorSRegister, $src$$VectorSRegister, $zero$$constant);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14095
  %} 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14096
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14097
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14098
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14099
instruct xxpermdi(vecX dst, vecX src1, vecX src2, immI8 zero) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14100
  effect(DEF dst, USE src1, USE src2, USE zero);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14101
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14102
  format %{ "XXPERMDI      $dst, $src1, $src2, $zero \t// Permute 16-byte register"%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14103
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14104
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14105
    __ xxpermdi($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister, $zero$$constant);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14106
  %} 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14107
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14108
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14109
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14110
instruct repl2L_reg_Ex(vecX dst, iRegLsrc src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14111
  match(Set dst (ReplicateL src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14112
  predicate(n->as_Vector()->length() == 2);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14113
  expand %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14114
    vecX tmpV;
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14115
    immI8  zero %{ (int)  0 %} 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14116
    mtvsrd(tmpV, src); 
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14117
    xxpermdi(dst, tmpV, tmpV, zero);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14118
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14119
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14120
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14121
instruct repl2L_immI0(vecX dst, immI_0 zero) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14122
  match(Set dst (ReplicateL zero));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14123
  predicate(n->as_Vector()->length() == 2);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14124
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14125
  format %{ "XXLXOR      $dst, $zero \t// replicate2L" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14126
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14127
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14128
    __ xxlxor($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14129
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14130
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14131
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14132
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14133
instruct repl2L_immIminus1(vecX dst, immI_minus1 src) %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14134
  match(Set dst (ReplicateL src));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14135
  predicate(n->as_Vector()->length() == 2);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14136
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14137
  format %{ "XXLEQV      $dst, $src \t// replicate16B" %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14138
  size(4);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14139
  ins_encode %{
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14140
    __ xxleqv($dst$$VectorSRegister, $dst$$VectorSRegister, $dst$$VectorSRegister);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14141
  %}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14142
  ins_pipe(pipe_class_default);
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14143
%}
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
 14144
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14145
// ============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14146
// Safepoint Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14147
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14148
instruct safePoint_poll(iRegPdst poll) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14149
  match(SafePoint poll);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14150
  predicate(LoadPollAddressFromThread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14151
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14152
  // 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
 14153
  // effect no longer needs to be mentioned, since r0 is not contained
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14154
  // in a reg_class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14155
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14156
  format %{ "LD      R0, #0, $poll \t// Safepoint poll for GC" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14157
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14158
  ins_encode( enc_poll(0x0, poll) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14159
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14160
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14161
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14162
// Safepoint without per-thread support. Load address of page to poll
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14163
// as constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14164
// Rscratch2RegP is R12.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14165
// LoadConPollAddr node is added in pd_post_matching_hook(). It must be
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14166
// 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
 14167
instruct safePoint_poll_conPollAddr(rscratch2RegP poll) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14168
  match(SafePoint poll);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14169
  predicate(!LoadPollAddressFromThread);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14170
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14171
  // 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
 14172
  // effect no longer needs to be mentioned, since r0 is not contained
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14173
  // in a reg_class.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14174
23492
af5352f40e65 8037915: PPC64/AIX: Several smaller fixes
goetz
parents: 23211
diff changeset
 14175
  format %{ "LD      R0, #0, R12 \t// Safepoint poll for GC" %}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14176
  ins_encode( enc_poll(0x0, poll) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14177
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14178
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14179
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14180
// ============================================================================
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14181
// Call Instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14182
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14183
// Call Java Static Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14184
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14185
// Schedulable version of call static node.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14186
instruct CallStaticJavaDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14187
  match(CallStaticJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14188
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14189
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14190
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14191
  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
 14192
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14193
  format %{ "CALL,static $meth \t// ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14194
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14195
  ins_encode( enc_java_static_call(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14196
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14197
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14198
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14199
// Call Java Dynamic Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14200
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14201
// Used by postalloc expand of CallDynamicJavaDirectSchedEx (actual call).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14202
// 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
 14203
// 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
 14204
// The call destination must still be placed in the constant pool.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14205
instruct CallDynamicJavaDirectSched(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14206
  match(CallDynamicJava); // To get all the data fields we need ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14207
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14208
  predicate(false);       // ... but never match.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14209
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14210
  ins_field_load_ic_hi_node(loadConL_hiNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14211
  ins_field_load_ic_node(loadConLNode*);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14212
  ins_num_consts(1 /* 1 patchable constant: call destination */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14213
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14214
  format %{ "BL        \t// dynamic $meth ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14215
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14216
  ins_encode( enc_java_dynamic_call_sched(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14217
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14218
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14219
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14220
// Schedulable (i.e. postalloc expanded) version of call dynamic java.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14221
// We use postalloc expanded calls if we use inline caches
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14222
// and do not update method data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14223
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14224
// This instruction has two constants: inline cache (IC) and call destination.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14225
// 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
 14226
// one constant.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14227
instruct CallDynamicJavaDirectSched_Ex(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14228
  match(CallDynamicJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14229
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14230
  predicate(UseInlineCaches);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14231
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14232
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14233
  ins_num_consts(2 /* 2 patchable constants: inline cache, call destination. */);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14234
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14235
  format %{ "CALL,dynamic $meth \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14236
  postalloc_expand( postalloc_expand_java_dynamic_call_sched(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14237
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14238
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14239
// Compound version of call dynamic java
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14240
// We use postalloc expanded calls if we use inline caches
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14241
// and do not update method data.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14242
instruct CallDynamicJavaDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14243
  match(CallDynamicJava);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14244
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14245
  predicate(!UseInlineCaches);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14246
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14247
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14248
  // 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
 14249
  ins_num_consts(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14250
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14251
  format %{ "CALL,dynamic $meth \t// ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14252
  ins_encode( enc_java_dynamic_call(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14253
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14254
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14255
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14256
// Call Runtime Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14257
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14258
instruct CallRuntimeDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14259
  match(CallRuntime);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14260
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14261
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14262
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14263
  // Enc_java_to_runtime_call needs up to 3 constants: call target,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14264
  // env for callee, C-toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14265
  ins_num_consts(3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14266
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14267
  format %{ "CALL,runtime" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14268
  ins_encode( enc_java_to_runtime_call(meth) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14269
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14270
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14271
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14272
// Call Leaf
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14273
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14274
// Used by postalloc expand of CallLeafDirect_Ex (mtctr).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14275
instruct CallLeafDirect_mtctr(iRegLdst dst, iRegLsrc src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14276
  effect(DEF dst, USE src);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14277
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14278
  ins_num_consts(1);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14279
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14280
  format %{ "MTCTR   $src" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14281
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14282
  ins_encode( enc_leaf_call_mtctr(src) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14283
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14284
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14285
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14286
// Used by postalloc expand of CallLeafDirect_Ex (actual call).
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14287
instruct CallLeafDirect(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14288
  match(CallLeaf);   // To get the data all the data fields we need ...
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14289
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14290
  predicate(false);  // but never match.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14291
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14292
  format %{ "BCTRL     \t// leaf call $meth ==> " %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14293
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14294
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14295
    // TODO: PPC port $archOpcode(ppc64Opcode_bctrl);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14296
    __ bctrl();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14297
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14298
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14299
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14300
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14301
// postalloc expand of CallLeafDirect.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14302
// Load adress to call from TOC, then bl to it.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14303
instruct CallLeafDirect_Ex(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14304
  match(CallLeaf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14305
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14306
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14307
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14308
  // 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
 14309
  // env for callee, C-toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14310
  ins_num_consts(3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14311
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14312
  format %{ "CALL,runtime leaf $meth \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14313
  postalloc_expand( postalloc_expand_java_to_runtime_call(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14314
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14315
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14316
// Call runtime without safepoint - same as CallLeaf.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14317
// postalloc expand of CallLeafNoFPDirect.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14318
// Load adress to call from TOC, then bl to it.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14319
instruct CallLeafNoFPDirect_Ex(method meth) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14320
  match(CallLeafNoFP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14321
  effect(USE meth);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14322
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14323
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14324
  // Enc_java_to_runtime_call needs up to 3 constants: call target,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14325
  // env for callee, C-toc.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14326
  ins_num_consts(3);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14327
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14328
  format %{ "CALL,runtime leaf nofp $meth \t// postalloc expanded" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14329
  postalloc_expand( postalloc_expand_java_to_runtime_call(meth, constanttablebase) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14330
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14331
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14332
// Tail Call; Jump from runtime stub to Java code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14333
// Also known as an 'interprocedural jump'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14334
// Target of jump will eventually return to caller.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14335
// TailJump below removes the return address.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14336
instruct TailCalljmpInd(iRegPdstNoScratch jump_target, inline_cache_regP method_oop) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14337
  match(TailCall jump_target method_oop);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14338
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14339
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14340
  format %{ "MTCTR   $jump_target \t// $method_oop holds method oop\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14341
            "BCTR         \t// tail call" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14342
  size(8);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14343
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14344
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14345
    __ mtctr($jump_target$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14346
    __ bctr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14347
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14348
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14349
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14350
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14351
// Return Instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14352
instruct Ret() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14353
  match(Return);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14354
  format %{ "BLR      \t// branch to link register" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14355
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14356
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14357
    // TODO: PPC port $archOpcode(ppc64Opcode_blr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14358
    // LR is restored in MachEpilogNode. Just do the RET here.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14359
    __ blr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14360
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14361
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14362
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14363
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14364
// Tail Jump; remove the return address; jump to target.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14365
// TailCall above leaves the return address around.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14366
// 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
 14367
// 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
 14368
// "restore" before this instruction (in Epilogue), we need to materialize it
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14369
// in %i0.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14370
instruct tailjmpInd(iRegPdstNoScratch jump_target, rarg1RegP ex_oop) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14371
  match(TailJump jump_target ex_oop);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14372
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14373
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14374
  format %{ "LD      R4_ARG2 = LR\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14375
            "MTCTR   $jump_target\n\t"
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14376
            "BCTR     \t// TailJump, exception oop: $ex_oop" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14377
  size(12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14378
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14379
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14380
    __ ld(R4_ARG2/* issuing pc */, _abi(lr), R1_SP);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14381
    __ mtctr($jump_target$$Register);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14382
    __ bctr();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14383
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14384
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14385
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14386
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14387
// Create exception oop: created by stack-crawling runtime code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14388
// Created exception is now available to this handler, and is setup
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14389
// just prior to jumping to this handler. No code emitted.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14390
instruct CreateException(rarg1RegP ex_oop) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14391
  match(Set ex_oop (CreateEx));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14392
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14393
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14394
  format %{ " -- \t// exception oop; no code emitted" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14395
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14396
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14397
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14398
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14399
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14400
// Rethrow exception: The exception oop will come in the first
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14401
// argument position. Then JUMP (not call) to the rethrow stub code.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14402
instruct RethrowException() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14403
  match(Rethrow);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14404
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14405
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14406
  format %{ "Jmp     rethrow_stub" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14407
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14408
    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14409
    cbuf.set_insts_mark();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14410
    __ b64_patchable((address)OptoRuntime::rethrow_stub(), relocInfo::runtime_call_type);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14411
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14412
  ins_pipe(pipe_class_call);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14413
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14414
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14415
// Die now.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14416
instruct ShouldNotReachHere() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14417
  match(Halt);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14418
  ins_cost(CALL_COST);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14419
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14420
  format %{ "ShouldNotReachHere" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14421
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14422
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14423
    // TODO: PPC port $archOpcode(ppc64Opcode_tdi);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14424
    __ trap_should_not_reach_here();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14425
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14426
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14427
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14428
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14429
// 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
 14430
// forces a 'TypeRawPtr::BOTTOM' output type for this guy.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14431
// Get a DEF on threadRegP, no costs, no encoding, use
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14432
// 'ins_should_rematerialize(true)' to avoid spilling.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14433
instruct tlsLoadP(threadRegP dst) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14434
  match(Set dst (ThreadLocal));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14435
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14436
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14437
  ins_should_rematerialize(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14438
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14439
  format %{ " -- \t// $dst=Thread::current(), empty" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14440
  size(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14441
  ins_encode( /*empty*/ );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14442
  ins_pipe(pipe_class_empty);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14443
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14444
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14445
//---Some PPC specific nodes---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14446
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14447
// Stop a group.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14448
instruct endGroup() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14449
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14450
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14451
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14452
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14453
  format %{ "End Bundle (ori r1, r1, 0)" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14454
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14455
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14456
    // TODO: PPC port $archOpcode(ppc64Opcode_endgroup);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14457
    __ endgroup();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14458
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14459
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14460
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14461
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14462
// Nop instructions
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14463
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14464
instruct fxNop() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14465
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14466
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14467
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14468
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14469
  format %{ "fxNop" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14470
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14471
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14472
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14473
    __ nop();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14474
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14475
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14476
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14477
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14478
instruct fpNop0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14479
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14480
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14481
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14482
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14483
  format %{ "fpNop0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14484
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14485
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14486
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14487
    __ fpnop0();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14488
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14489
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14490
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14491
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14492
instruct fpNop1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14493
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14494
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14495
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14496
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14497
  format %{ "fpNop1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14498
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14499
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14500
    // TODO: PPC port $archOpcode(ppc64Opcode_fmr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14501
    __ fpnop1();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14502
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14503
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14504
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14505
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14506
instruct brNop0() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14507
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14508
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14509
  format %{ "brNop0" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14510
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14511
    // TODO: PPC port $archOpcode(ppc64Opcode_mcrf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14512
    __ brnop0();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14513
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14514
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14515
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14516
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14517
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14518
instruct brNop1() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14519
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14520
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14521
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14522
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14523
  format %{ "brNop1" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14524
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14525
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14526
    // TODO: PPC port $archOpcode(ppc64Opcode_mcrf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14527
    __ brnop1();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14528
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14529
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14530
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14531
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14532
instruct brNop2() %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14533
  ins_cost(0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14534
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14535
  ins_is_nop(true);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14536
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14537
  format %{ "brNop2" %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14538
  size(4);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14539
  ins_encode %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14540
    // TODO: PPC port $archOpcode(ppc64Opcode_mcrf);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14541
    __ brnop2();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14542
  %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14543
  ins_pipe(pipe_class_default);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14544
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14545
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14546
//----------PEEPHOLE RULES-----------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14547
// These must follow all instruction definitions as they use the names
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14548
// defined in the instructions definitions.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14549
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14550
// peepmatch ( root_instr_name [preceeding_instruction]* );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14551
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14552
// peepconstraint %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14553
// (instruction_number.operand_name relational_op instruction_number.operand_name
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14554
//  [, ...] );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14555
// // instruction numbers are zero-based using left to right order in peepmatch
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14556
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14557
// peepreplace ( instr_name ( [instruction_number.operand_name]* ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14558
// // provide an instruction_number.operand_name for each operand that appears
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14559
// // in the replacement instruction's match rule
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14560
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14561
// ---------VM FLAGS---------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14562
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14563
// All peephole optimizations can be turned off using -XX:-OptoPeephole
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14564
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14565
// Each peephole rule is given an identifying number starting with zero and
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14566
// 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
 14567
// can be enabled, and all others disabled, by using -XX:OptoPeepholeAt=#
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14568
// on the command-line.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14569
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14570
// ---------CURRENT LIMITATIONS----------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14571
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14572
// Only match adjacent instructions in same basic block
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14573
// Only equality constraints
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14574
// Only constraints between operands, not (0.dest_reg == EAX_enc)
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14575
// Only one replacement instruction
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14576
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14577
// ---------EXAMPLE----------------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14578
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14579
// // pertinent parts of existing instructions in architecture description
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14580
// instruct movI(eRegI dst, eRegI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14581
//   match(Set dst (CopyI src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14582
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14583
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14584
// instruct incI_eReg(eRegI dst, immI1 src, eFlagsReg cr) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14585
//   match(Set dst (AddI dst src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14586
//   effect(KILL cr);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14587
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14588
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14589
// // Change (inc mov) to lea
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14590
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14591
//   // increment preceeded by register-register move
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14592
//   peepmatch ( incI_eReg movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14593
//   // require that the destination register of the increment
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14594
//   // match the destination register of the move
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14595
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14596
//   // construct a replacement instruction that sets
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14597
//   // the destination to ( move's source register + one )
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14598
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14599
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14600
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14601
// Implementation no longer uses movX instructions since
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14602
// machine-independent system no longer uses CopyX nodes.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14603
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14604
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14605
//   peepmatch ( incI_eReg movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14606
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14607
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14608
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14609
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14610
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14611
//   peepmatch ( decI_eReg movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14612
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14613
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14614
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14615
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14616
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14617
//   peepmatch ( addI_eReg_imm movI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14618
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14619
//   peepreplace ( leaI_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14620
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14621
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14622
// peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14623
//   peepmatch ( addP_eReg_imm movP );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14624
//   peepconstraint ( 0.dst == 1.dst );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14625
//   peepreplace ( leaP_eReg_immI( 0.dst 1.src 0.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14626
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14627
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14628
// // Change load of spilled value to only a spill
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14629
// instruct storeI(memory mem, eRegI src) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14630
//   match(Set mem (StoreI mem src));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14631
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14632
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14633
// instruct loadI(eRegI dst, memory mem) %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14634
//   match(Set dst (LoadI mem));
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14635
// %}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14636
//
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14637
peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14638
  peepmatch ( loadI storeI );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14639
  peepconstraint ( 1.src == 0.dst, 1.mem == 0.mem );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14640
  peepreplace ( storeI( 1.mem 1.mem 1.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14641
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14642
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14643
peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14644
  peepmatch ( loadL storeL );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14645
  peepconstraint ( 1.src == 0.dst, 1.mem == 0.mem );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14646
  peepreplace ( storeL( 1.mem 1.mem 1.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14647
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14648
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14649
peephole %{
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14650
  peepmatch ( loadP storeP );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14651
  peepconstraint ( 1.src == 0.dst, 1.dst == 0.mem );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14652
  peepreplace ( storeP( 1.dst 1.dst 1.src ) );
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14653
%}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14654
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14655
//----------SMARTSPILL RULES---------------------------------------------------
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14656
// These must follow all instruction definitions as they use the names
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents:
diff changeset
 14657
// defined in the instructions definitions.