src/hotspot/cpu/aarch64/aarch64_ad.m4
author naoto
Tue, 09 Jul 2019 08:05:38 -0700
changeset 55627 9c1885fb2a42
parent 54604 367d9cc2b35e
permissions -rw-r--r--
8227127: Era designator not displayed correctly using the COMPAT provider Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     1
dnl Copyright (c) 2014, Red Hat Inc. All rights reserved.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     2
dnl DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     3
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     4
dnl This code is free software; you can redistribute it and/or modify it
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     5
dnl under the terms of the GNU General Public License version 2 only, as
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     6
dnl published by the Free Software Foundation.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     7
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     8
dnl This code is distributed in the hope that it will be useful, but WITHOUT
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     9
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    10
dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    11
dnl version 2 for more details (a copy is included in the LICENSE file that
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    12
dnl accompanied this code).
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    13
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    14
dnl You should have received a copy of the GNU General Public License version
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    15
dnl 2 along with this work; if not, write to the Free Software Foundation,
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    16
dnl Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    17
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    18
dnl Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    19
dnl or visit www.oracle.com if you need additional information or have any
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    20
dnl questions.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    21
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    22
dnl 
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    23
dnl Process this file with m4 aarch64_ad.m4 to generate the arithmetic
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    24
dnl and shift patterns patterns used in aarch64.ad.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    25
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    26
// BEGIN This section of the file is automatically generated. Do not edit --------------
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
    27
dnl
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
    28
define(`ORL2I', `ifelse($1,I,orL2I)')
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
    29
dnl
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    30
define(`BASE_SHIFT_INSN',
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    31
`
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    32
instruct $2$1_reg_$4_reg(iReg$1NoSp dst,
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
    33
                         iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2,
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    34
                         immI src3, rFlagsReg cr) %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    35
  match(Set dst ($2$1 src1 ($4$1 src2 src3)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    36
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    37
  ins_cost(1.9 * INSN_COST);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    38
  format %{ "$3  $dst, $src1, $src2, $5 $src3" %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    39
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    40
  ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    41
    __ $3(as_Register($dst$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    42
              as_Register($src1$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    43
              as_Register($src2$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    44
              Assembler::$5,
32399
82a75c8c8079 8133842: aarch64: C2 generates illegal instructions with int shifts >=32
enevill
parents: 29568
diff changeset
    45
              $src3$$constant & ifelse($1,I,0x1f,0x3f));
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    46
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    47
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    48
  ins_pipe(ialu_reg_reg_shift);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    49
%}')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    50
define(`BASE_INVERTED_INSN',
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    51
`
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    52
instruct $2$1_reg_not_reg(iReg$1NoSp dst,
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
    53
                         iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2, imm$1_M1 m1,
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    54
                         rFlagsReg cr) %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    55
dnl This ifelse is because hotspot reassociates (xor (xor ..)..)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    56
dnl into this canonical form.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    57
  ifelse($2,Xor,
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    58
    match(Set dst (Xor$1 m1 (Xor$1 src2 src1)));,
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    59
    match(Set dst ($2$1 src1 (Xor$1 src2 m1)));)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    60
  ins_cost(INSN_COST);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    61
  format %{ "$3  $dst, $src1, $src2" %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    62
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    63
  ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    64
    __ $3(as_Register($dst$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    65
              as_Register($src1$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    66
              as_Register($src2$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    67
              Assembler::LSL, 0);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    68
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    69
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    70
  ins_pipe(ialu_reg_reg);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    71
%}')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    72
define(`INVERTED_SHIFT_INSN',
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    73
`
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    74
instruct $2$1_reg_$4_not_reg(iReg$1NoSp dst,
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
    75
                         iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2,
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    76
                         immI src3, imm$1_M1 src4, rFlagsReg cr) %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    77
dnl This ifelse is because hotspot reassociates (xor (xor ..)..)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    78
dnl into this canonical form.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    79
  ifelse($2,Xor,
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    80
    match(Set dst ($2$1 src4 (Xor$1($4$1 src2 src3) src1)));,
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    81
    match(Set dst ($2$1 src1 (Xor$1($4$1 src2 src3) src4)));)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    82
  ins_cost(1.9 * INSN_COST);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    83
  format %{ "$3  $dst, $src1, $src2, $5 $src3" %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    84
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    85
  ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    86
    __ $3(as_Register($dst$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    87
              as_Register($src1$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    88
              as_Register($src2$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    89
              Assembler::$5,
32399
82a75c8c8079 8133842: aarch64: C2 generates illegal instructions with int shifts >=32
enevill
parents: 29568
diff changeset
    90
              $src3$$constant & ifelse($1,I,0x1f,0x3f));
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    91
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    92
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    93
  ins_pipe(ialu_reg_reg_shift);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    94
%}')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    95
define(`NOT_INSN',
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    96
`instruct reg$1_not_reg(iReg$1NoSp dst,
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
    97
                         iReg$1`'ORL2I($1) src1, imm$1_M1 m1,
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    98
                         rFlagsReg cr) %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    99
  match(Set dst (Xor$1 src1 m1));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   100
  ins_cost(INSN_COST);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   101
  format %{ "$2  $dst, $src1, zr" %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   102
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   103
  ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   104
    __ $2(as_Register($dst$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   105
              as_Register($src1$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   106
              zr,
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   107
              Assembler::LSL, 0);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   108
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   109
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   110
  ins_pipe(ialu_reg);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   111
%}')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   112
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   113
define(`BOTH_SHIFT_INSNS',
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   114
`BASE_SHIFT_INSN(I, $1, ifelse($2,andr,andw,$2w), $3, $4)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   115
BASE_SHIFT_INSN(L, $1, $2, $3, $4)')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   116
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   117
define(`BOTH_INVERTED_INSNS',
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
   118
`BASE_INVERTED_INSN(I, $1, $2w, $3, $4)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   119
BASE_INVERTED_INSN(L, $1, $2, $3, $4)')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   120
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   121
define(`BOTH_INVERTED_SHIFT_INSNS',
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   122
`INVERTED_SHIFT_INSN(I, $1, $2w, $3, $4, ~0, int)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   123
INVERTED_SHIFT_INSN(L, $1, $2, $3, $4, ~0l, long)')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   124
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   125
define(`ALL_SHIFT_KINDS',
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   126
`BOTH_SHIFT_INSNS($1, $2, URShift, LSR)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   127
BOTH_SHIFT_INSNS($1, $2, RShift, ASR)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   128
BOTH_SHIFT_INSNS($1, $2, LShift, LSL)')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   129
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   130
define(`ALL_INVERTED_SHIFT_KINDS',
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   131
`BOTH_INVERTED_SHIFT_INSNS($1, $2, URShift, LSR)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   132
BOTH_INVERTED_SHIFT_INSNS($1, $2, RShift, ASR)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   133
BOTH_INVERTED_SHIFT_INSNS($1, $2, LShift, LSL)')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   134
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   135
NOT_INSN(L, eon)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   136
NOT_INSN(I, eonw)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   137
BOTH_INVERTED_INSNS(And, bic)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   138
BOTH_INVERTED_INSNS(Or, orn)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   139
BOTH_INVERTED_INSNS(Xor, eon)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   140
ALL_INVERTED_SHIFT_KINDS(And, bic)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   141
ALL_INVERTED_SHIFT_KINDS(Xor, eon)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   142
ALL_INVERTED_SHIFT_KINDS(Or, orn)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   143
ALL_SHIFT_KINDS(And, andr)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   144
ALL_SHIFT_KINDS(Xor, eor)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   145
ALL_SHIFT_KINDS(Or, orr)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   146
ALL_SHIFT_KINDS(Add, add)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   147
ALL_SHIFT_KINDS(Sub, sub)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   148
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   149
dnl EXTEND mode, rshift_op, src, lshift_count, rshift_count
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   150
define(`EXTEND', `($2$1 (LShift$1 $3 $4) $5)')
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   151
define(`BFM_INSN',`
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   152
// Shift Left followed by Shift Right.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   153
// This idiom is used by the compiler for the i2b bytecode etc.
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
   154
instruct $4$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI lshift_count, immI rshift_count)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   155
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   156
  match(Set dst EXTEND($1, $3, src, lshift_count, rshift_count));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   157
  ins_cost(INSN_COST * 2);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   158
  format %{ "$4  $dst, $src, $rshift_count - $lshift_count, #$2 - $lshift_count" %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   159
  ins_encode %{
54604
367d9cc2b35e 8222785: aarch64: add necessary masking for immediate shift counts
fyang
parents: 54474
diff changeset
   160
    int lshift = $lshift_count$$constant & $2;
367d9cc2b35e 8222785: aarch64: add necessary masking for immediate shift counts
fyang
parents: 54474
diff changeset
   161
    int rshift = $rshift_count$$constant & $2;
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   162
    int s = $2 - lshift;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   163
    int r = (rshift - lshift) & $2;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   164
    __ $4(as_Register($dst$$reg),
29190
9917b8aed927 8072483: AARCH64: aarch64.ad uses the wrong operand class for some operations
aph
parents: 29184
diff changeset
   165
            as_Register($src$$reg),
9917b8aed927 8072483: AARCH64: aarch64.ad uses the wrong operand class for some operations
aph
parents: 29184
diff changeset
   166
            r, s);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   167
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   168
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   169
  ins_pipe(ialu_reg_shift);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   170
%}')
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   171
BFM_INSN(L, 63, RShift, sbfm)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   172
BFM_INSN(I, 31, RShift, sbfmw)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   173
BFM_INSN(L, 63, URShift, ubfm)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   174
BFM_INSN(I, 31, URShift, ubfmw)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   175
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   176
// Bitfield extract with shift & mask
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   177
define(`BFX_INSN',
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
   178
`instruct $3$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI rshift, imm$1_bitmask mask)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   179
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   180
  match(Set dst (And$1 ($2$1 src rshift) mask));
54474
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   181
  // Make sure we are not going to exceed what $3 can do.
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   182
  predicate((exact_log2$6(n->in(2)->get_$5() + 1) + (n->in(1)->in(2)->get_int() & $4)) <= ($4 + 1));
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   183
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   184
  ins_cost(INSN_COST);
47109
7aaffc8b46ce 8187022: AArch64: UBFX instructions have wrong format string
njian
parents: 46988
diff changeset
   185
  format %{ "$3 $dst, $src, $rshift, $mask" %}
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   186
  ins_encode %{
54474
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   187
    int rshift = $rshift$$constant & $4;
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   188
    long mask = $mask$$constant;
54474
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   189
    int width = exact_log2$6(mask+1);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   190
    __ $3(as_Register($dst$$reg),
29190
9917b8aed927 8072483: AARCH64: aarch64.ad uses the wrong operand class for some operations
aph
parents: 29184
diff changeset
   191
            as_Register($src$$reg), rshift, width);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   192
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   193
  ins_pipe(ialu_reg_shift);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   194
%}')
54474
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   195
BFX_INSN(I, URShift, ubfxw, 31, int)
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   196
BFX_INSN(L, URShift, ubfx,  63, long, _long)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   197
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   198
// We can use ubfx when extending an And with a mask when we know mask
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   199
// is positive.  We know that because immI_bitmask guarantees it.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   200
instruct ubfxIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI rshift, immI_bitmask mask)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   201
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   202
  match(Set dst (ConvI2L (AndI (URShiftI src rshift) mask)));
54474
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   203
  // Make sure we are not going to exceed what ubfxw can do.
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   204
  predicate((exact_log2(n->in(1)->in(2)->get_int() + 1) + (n->in(1)->in(1)->in(2)->get_int() & 31)) <= (31 + 1));
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   205
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   206
  ins_cost(INSN_COST * 2);
47109
7aaffc8b46ce 8187022: AArch64: UBFX instructions have wrong format string
njian
parents: 46988
diff changeset
   207
  format %{ "ubfx $dst, $src, $rshift, $mask" %}
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   208
  ins_encode %{
54474
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   209
    int rshift = $rshift$$constant & 31;
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   210
    long mask = $mask$$constant;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   211
    int width = exact_log2(mask+1);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   212
    __ ubfx(as_Register($dst$$reg),
29190
9917b8aed927 8072483: AARCH64: aarch64.ad uses the wrong operand class for some operations
aph
parents: 29184
diff changeset
   213
            as_Register($src$$reg), rshift, width);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   214
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   215
  ins_pipe(ialu_reg_shift);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   216
%}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   217
46988
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   218
define(`UBFIZ_INSN',
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   219
// We can use ubfiz when masking by a positive number and then left shifting the result.
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   220
// We know that the mask is positive because imm$1_bitmask guarantees it.
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   221
`instruct $2$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI lshift, imm$1_bitmask mask)
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   222
%{
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   223
  match(Set dst (LShift$1 (And$1 src mask) lshift));
54604
367d9cc2b35e 8222785: aarch64: add necessary masking for immediate shift counts
fyang
parents: 54474
diff changeset
   224
  predicate((exact_log2$5(n->in(1)->in(2)->get_$4() + 1) + (n->in(2)->get_int() & $3)) <= ($3 + 1));
46988
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   225
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   226
  ins_cost(INSN_COST);
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   227
  format %{ "$2 $dst, $src, $lshift, $mask" %}
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   228
  ins_encode %{
54604
367d9cc2b35e 8222785: aarch64: add necessary masking for immediate shift counts
fyang
parents: 54474
diff changeset
   229
    int lshift = $lshift$$constant & $3;
46988
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   230
    long mask = $mask$$constant;
54474
0fa2903fb272 8221658: aarch64: add necessary predicate for ubfx patterns
fyang
parents: 47216
diff changeset
   231
    int width = exact_log2$5(mask+1);
46988
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   232
    __ $2(as_Register($dst$$reg),
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   233
          as_Register($src$$reg), lshift, width);
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   234
  %}
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   235
  ins_pipe(ialu_reg_shift);
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   236
%}')
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   237
UBFIZ_INSN(I, ubfizw, 31, int)
54604
367d9cc2b35e 8222785: aarch64: add necessary masking for immediate shift counts
fyang
parents: 54474
diff changeset
   238
UBFIZ_INSN(L, ubfiz,  63, long, _long)
46988
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   239
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   240
// If there is a convert I to L block between and AndI and a LShiftL, we can also match ubfiz
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   241
instruct ubfizIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI lshift, immI_bitmask mask)
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   242
%{
54604
367d9cc2b35e 8222785: aarch64: add necessary masking for immediate shift counts
fyang
parents: 54474
diff changeset
   243
  match(Set dst (LShiftL (ConvI2L (AndI src mask)) lshift));
367d9cc2b35e 8222785: aarch64: add necessary masking for immediate shift counts
fyang
parents: 54474
diff changeset
   244
  predicate((exact_log2(n->in(1)->in(1)->in(2)->get_int() + 1) + (n->in(2)->get_int() & 63)) <= (63 + 1));
46988
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   245
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   246
  ins_cost(INSN_COST);
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   247
  format %{ "ubfiz $dst, $src, $lshift, $mask" %}
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   248
  ins_encode %{
54604
367d9cc2b35e 8222785: aarch64: add necessary masking for immediate shift counts
fyang
parents: 54474
diff changeset
   249
    int lshift = $lshift$$constant & 63;
46988
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   250
    long mask = $mask$$constant;
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   251
    int width = exact_log2(mask+1);
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   252
    __ ubfiz(as_Register($dst$$reg),
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   253
             as_Register($src$$reg), lshift, width);
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   254
  %}
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   255
  ins_pipe(ialu_reg_shift);
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   256
%}
ede2513b035e 8184049: AArch64: Matching rule for ubfiz
njian
parents: 46719
diff changeset
   257
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   258
// Rotations
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   259
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   260
define(`EXTRACT_INSN',
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
   261
`instruct extr$3$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2, immI lshift, immI rshift, rFlagsReg cr)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   262
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   263
  match(Set dst ($3$1 (LShift$1 src1 lshift) (URShift$1 src2 rshift)));
54604
367d9cc2b35e 8222785: aarch64: add necessary masking for immediate shift counts
fyang
parents: 54474
diff changeset
   264
  predicate(0 == (((n->in(1)->in(2)->get_int() & $2) + (n->in(2)->in(2)->get_int() & $2)) & $2));
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   265
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   266
  ins_cost(INSN_COST);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   267
  format %{ "extr $dst, $src1, $src2, #$rshift" %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   268
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   269
  ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   270
    __ $4(as_Register($dst$$reg), as_Register($src1$$reg), as_Register($src2$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   271
            $rshift$$constant & $2);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   272
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   273
  ins_pipe(ialu_reg_reg_extr);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   274
%}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   275
')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   276
EXTRACT_INSN(L, 63, Or, extr)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   277
EXTRACT_INSN(I, 31, Or, extrw)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   278
EXTRACT_INSN(L, 63, Add, extr)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   279
EXTRACT_INSN(I, 31, Add, extrw)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   280
define(`ROL_EXPAND', `
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   281
// $2 expander
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   282
29190
9917b8aed927 8072483: AARCH64: aarch64.ad uses the wrong operand class for some operations
aph
parents: 29184
diff changeset
   283
instruct $2$1_rReg(iReg$1NoSp dst, iReg$1 src, iRegI shift, rFlagsReg cr)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   284
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   285
  effect(DEF dst, USE src, USE shift);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   286
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   287
  format %{ "$2    $dst, $src, $shift" %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   288
  ins_cost(INSN_COST * 3);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   289
  ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   290
    __ subw(rscratch1, zr, as_Register($shift$$reg));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   291
    __ $3(as_Register($dst$$reg), as_Register($src$$reg),
29190
9917b8aed927 8072483: AARCH64: aarch64.ad uses the wrong operand class for some operations
aph
parents: 29184
diff changeset
   292
            rscratch1);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   293
    %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   294
  ins_pipe(ialu_reg_reg_vshift);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   295
%}')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   296
define(`ROR_EXPAND', `
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   297
// $2 expander
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   298
29190
9917b8aed927 8072483: AARCH64: aarch64.ad uses the wrong operand class for some operations
aph
parents: 29184
diff changeset
   299
instruct $2$1_rReg(iReg$1NoSp dst, iReg$1 src, iRegI shift, rFlagsReg cr)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   300
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   301
  effect(DEF dst, USE src, USE shift);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   302
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   303
  format %{ "$2    $dst, $src, $shift" %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   304
  ins_cost(INSN_COST);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   305
  ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   306
    __ $3(as_Register($dst$$reg), as_Register($src$$reg),
29190
9917b8aed927 8072483: AARCH64: aarch64.ad uses the wrong operand class for some operations
aph
parents: 29184
diff changeset
   307
            as_Register($shift$$reg));
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   308
    %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   309
  ins_pipe(ialu_reg_reg_vshift);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   310
%}')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   311
define(ROL_INSN, `
46719
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   312
instruct $3$1_rReg_Var_C$2(iReg$1NoSp dst, iReg$1 src, iRegI shift, immI$2 c$2, rFlagsReg cr)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   313
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   314
  match(Set dst (Or$1 (LShift$1 src shift) (URShift$1 src (SubI c$2 shift))));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   315
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   316
  expand %{
46719
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   317
    $3$1_rReg(dst, src, shift, cr);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   318
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   319
%}')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   320
define(ROR_INSN, `
46719
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   321
instruct $3$1_rReg_Var_C$2(iReg$1NoSp dst, iReg$1 src, iRegI shift, immI$2 c$2, rFlagsReg cr)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   322
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   323
  match(Set dst (Or$1 (URShift$1 src shift) (LShift$1 src (SubI c$2 shift))));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   324
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   325
  expand %{
46719
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   326
    $3$1_rReg(dst, src, shift, cr);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   327
  %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   328
%}')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   329
ROL_EXPAND(L, rol, rorv)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   330
ROL_EXPAND(I, rol, rorvw)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   331
ROL_INSN(L, _64, rol)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   332
ROL_INSN(L, 0, rol)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   333
ROL_INSN(I, _32, rol)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   334
ROL_INSN(I, 0, rol)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   335
ROR_EXPAND(L, ror, rorv)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   336
ROR_EXPAND(I, ror, rorvw)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   337
ROR_INSN(L, _64, ror)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   338
ROR_INSN(L, 0, ror)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   339
ROR_INSN(I, _32, ror)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   340
ROR_INSN(I, 0, ror)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   341
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   342
// Add/subtract (extended)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   343
dnl ADD_SUB_EXTENDED(mode, size, add node, shift node, insn, shift type, wordsize
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   344
define(`ADD_SUB_CONV', `
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
   345
instruct $3Ext$1(iReg$2NoSp dst, iReg$2`'ORL2I($2) src1, iReg$1`'ORL2I($1) src2, rFlagsReg cr)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   346
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   347
  match(Set dst ($3$2 src1 (ConvI2L src2)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   348
  ins_cost(INSN_COST);
46719
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   349
  format %{ "$4  $dst, $src1, $src2, $5" %}
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   350
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   351
   ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   352
     __ $4(as_Register($dst$$reg), as_Register($src1$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   353
            as_Register($src2$$reg), ext::$5);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   354
   %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   355
  ins_pipe(ialu_reg_reg);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   356
%}')dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   357
ADD_SUB_CONV(I,L,Add,add,sxtw);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   358
ADD_SUB_CONV(I,L,Sub,sub,sxtw);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   359
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   360
define(`ADD_SUB_EXTENDED', `
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
   361
instruct $3Ext$1_$6(iReg$1NoSp dst, iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2, immI_`'eval($7-$2) lshift, immI_`'eval($7-$2) rshift, rFlagsReg cr)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   362
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   363
  match(Set dst ($3$1 src1 EXTEND($1, $4, src2, lshift, rshift)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   364
  ins_cost(INSN_COST);
46719
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   365
  format %{ "$5  $dst, $src1, $src2, $6" %}
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   366
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   367
   ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   368
     __ $5(as_Register($dst$$reg), as_Register($src1$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   369
            as_Register($src2$$reg), ext::$6);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   370
   %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   371
  ins_pipe(ialu_reg_reg);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   372
%}')
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   373
ADD_SUB_EXTENDED(I,16,Add,RShift,add,sxth,32)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   374
ADD_SUB_EXTENDED(I,8,Add,RShift,add,sxtb,32)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   375
ADD_SUB_EXTENDED(I,8,Add,URShift,add,uxtb,32)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   376
ADD_SUB_EXTENDED(L,16,Add,RShift,add,sxth,64)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   377
ADD_SUB_EXTENDED(L,32,Add,RShift,add,sxtw,64)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   378
ADD_SUB_EXTENDED(L,8,Add,RShift,add,sxtb,64)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   379
ADD_SUB_EXTENDED(L,8,Add,URShift,add,uxtb,64)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   380
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   381
dnl ADD_SUB_ZERO_EXTEND(mode, size, add node, insn, shift type)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   382
define(`ADD_SUB_ZERO_EXTEND', `
29568
8c1cc431f388 8075443: AARCH64: Missed L2I optimizations in C2
aph
parents: 29190
diff changeset
   383
instruct $3Ext$1_$5_and(iReg$1NoSp dst, iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2, imm$1_$2 mask, rFlagsReg cr)
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   384
%{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   385
  match(Set dst ($3$1 src1 (And$1 src2 mask)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   386
  ins_cost(INSN_COST);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   387
  format %{ "$4  $dst, $src1, $src2, $5" %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   388
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   389
   ins_encode %{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   390
     __ $4(as_Register($dst$$reg), as_Register($src1$$reg),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   391
            as_Register($src2$$reg), ext::$5);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   392
   %}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   393
  ins_pipe(ialu_reg_reg);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   394
%}')
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   395
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   396
ADD_SUB_ZERO_EXTEND(I,255,Add,addw,uxtb)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   397
ADD_SUB_ZERO_EXTEND(I,65535,Add,addw,uxth)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   398
ADD_SUB_ZERO_EXTEND(L,255,Add,add,uxtb)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   399
ADD_SUB_ZERO_EXTEND(L,65535,Add,add,uxth)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   400
ADD_SUB_ZERO_EXTEND(L,4294967295,Add,add,uxtw)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   401
dnl
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   402
ADD_SUB_ZERO_EXTEND(I,255,Sub,subw,uxtb)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   403
ADD_SUB_ZERO_EXTEND(I,65535,Sub,subw,uxth)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   404
ADD_SUB_ZERO_EXTEND(L,255,Sub,sub,uxtb)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   405
ADD_SUB_ZERO_EXTEND(L,65535,Sub,sub,uxth)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   406
ADD_SUB_ZERO_EXTEND(L,4294967295,Sub,sub,uxtw)
46719
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   407
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   408
dnl ADD_SUB_ZERO_EXTEND_SHIFT(mode, size, add node, insn, ext type)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   409
define(`ADD_SUB_EXTENDED_SHIFT', `
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   410
instruct $3Ext$1_$6_shift(iReg$1NoSp dst, iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2, immIExt lshift2, immI_`'eval($7-$2) lshift1, immI_`'eval($7-$2) rshift1, rFlagsReg cr)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   411
%{
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   412
  match(Set dst ($3$1 src1 (LShift$1 EXTEND($1, $4, src2, lshift1, rshift1) lshift2)));
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   413
  ins_cost(1.9 * INSN_COST);
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   414
  format %{ "$5  $dst, $src1, $src2, $6 #lshift2" %}
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   415
46719
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   416
   ins_encode %{
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   417
     __ $5(as_Register($dst$$reg), as_Register($src1$$reg),
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   418
            as_Register($src2$$reg), ext::$6, ($lshift2$$constant));
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   419
   %}
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   420
  ins_pipe(ialu_reg_reg_shift);
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   421
%}')
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   422
dnl                   $1 $2 $3   $4   $5   $6  $7
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   423
ADD_SUB_EXTENDED_SHIFT(L,8,Add,RShift,add,sxtb,64)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   424
ADD_SUB_EXTENDED_SHIFT(L,16,Add,RShift,add,sxth,64)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   425
ADD_SUB_EXTENDED_SHIFT(L,32,Add,RShift,add,sxtw,64)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   426
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   427
ADD_SUB_EXTENDED_SHIFT(L,8,Sub,RShift,sub,sxtb,64)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   428
ADD_SUB_EXTENDED_SHIFT(L,16,Sub,RShift,sub,sxth,64)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   429
ADD_SUB_EXTENDED_SHIFT(L,32,Sub,RShift,sub,sxtw,64)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   430
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   431
ADD_SUB_EXTENDED_SHIFT(I,8,Add,RShift,addw,sxtb,32)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   432
ADD_SUB_EXTENDED_SHIFT(I,16,Add,RShift,addw,sxth,32)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   433
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   434
ADD_SUB_EXTENDED_SHIFT(I,8,Sub,RShift,subw,sxtb,32)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   435
ADD_SUB_EXTENDED_SHIFT(I,16,Sub,RShift,subw,sxth,32)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   436
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   437
dnl ADD_SUB_CONV_SHIFT(mode, add node, insn, ext type)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   438
define(`ADD_SUB_CONV_SHIFT', `
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   439
instruct $2ExtI_shift(iReg$1NoSp dst, iReg$1`'ORL2I($1) src1, iRegIorL2I src2, immIExt lshift, rFlagsReg cr)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   440
%{
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   441
  match(Set dst ($2$1 src1 (LShiftL (ConvI2L src2) lshift)));
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   442
  ins_cost(1.9 * INSN_COST);
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   443
  format %{ "$3  $dst, $src1, $src2, $4 #lshift" %}
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   444
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   445
   ins_encode %{
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   446
     __ $3(as_Register($dst$$reg), as_Register($src1$$reg),
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   447
            as_Register($src2$$reg), ext::$4, ($lshift$$constant));
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   448
   %}
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   449
  ins_pipe(ialu_reg_reg_shift);
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   450
%}')
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   451
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   452
ADD_SUB_CONV_SHIFT(L,Add,add,sxtw);
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   453
ADD_SUB_CONV_SHIFT(L,Sub,sub,sxtw);
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   454
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   455
dnl ADD_SUB_ZERO_EXTEND(mode, size, add node, insn, ext type)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   456
define(`ADD_SUB_ZERO_EXTEND_SHIFT', `
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   457
instruct $3Ext$1_$5_and_shift(iReg$1NoSp dst, iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2, imm$1_$2 mask, immIExt lshift, rFlagsReg cr)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   458
%{
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   459
  match(Set dst ($3$1 src1 (LShift$1 (And$1 src2 mask) lshift)));
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   460
  ins_cost(1.9 * INSN_COST);
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   461
  format %{ "$4  $dst, $src1, $src2, $5 #lshift" %}
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   462
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   463
   ins_encode %{
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   464
     __ $4(as_Register($dst$$reg), as_Register($src1$$reg),
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   465
            as_Register($src2$$reg), ext::$5, ($lshift$$constant));
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   466
   %}
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   467
  ins_pipe(ialu_reg_reg_shift);
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   468
%}')
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   469
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   470
dnl                       $1 $2  $3  $4  $5
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   471
ADD_SUB_ZERO_EXTEND_SHIFT(L,255,Add,add,uxtb)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   472
ADD_SUB_ZERO_EXTEND_SHIFT(L,65535,Add,add,uxth)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   473
ADD_SUB_ZERO_EXTEND_SHIFT(L,4294967295,Add,add,uxtw)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   474
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   475
ADD_SUB_ZERO_EXTEND_SHIFT(L,255,Sub,sub,uxtb)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   476
ADD_SUB_ZERO_EXTEND_SHIFT(L,65535,Sub,sub,uxth)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   477
ADD_SUB_ZERO_EXTEND_SHIFT(L,4294967295,Sub,sub,uxtw)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   478
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   479
ADD_SUB_ZERO_EXTEND_SHIFT(I,255,Add,addw,uxtb)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   480
ADD_SUB_ZERO_EXTEND_SHIFT(I,65535,Add,addw,uxth)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   481
dnl
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   482
ADD_SUB_ZERO_EXTEND_SHIFT(I,255,Sub,subw,uxtb)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   483
ADD_SUB_ZERO_EXTEND_SHIFT(I,65535,Sub,subw,uxth)
0de742eacb75 8158361: AArch64: Address calculation missed optimizations
njian
parents: 32399
diff changeset
   484
dnl
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   485
// END This section of the file is automatically generated. Do not edit --------------