src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/vector/AMD64VectorCompareOp.java
author dlong
Thu, 14 Nov 2019 12:21:00 -0800
changeset 59095 03fbcd06b4c0
parent 58299 6df94ce3ab2f
permissions -rw-r--r--
8233841: Update Graal Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
     1
/*
58299
6df94ce3ab2f 8229201: Update Graal
dlong
parents: 51436
diff changeset
     2
 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
     4
 *
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
     8
 *
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    13
 * accompanied this code).
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    14
 *
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    18
 *
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    21
 * questions.
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    22
 */
50858
2d3e99a72541 8205824: Update Graal
never
parents: 50609
diff changeset
    23
2d3e99a72541 8205824: Update Graal
never
parents: 50609
diff changeset
    24
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    25
package org.graalvm.compiler.lir.amd64.vector;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    26
51436
091c0d22e735 8206992: Update Graal
iveresov
parents: 50858
diff changeset
    27
import static jdk.vm.ci.code.ValueUtil.asRegister;
091c0d22e735 8206992: Update Graal
iveresov
parents: 50858
diff changeset
    28
import static jdk.vm.ci.code.ValueUtil.isRegister;
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    29
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    30
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    31
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    32
import org.graalvm.compiler.asm.amd64.AMD64Address;
51436
091c0d22e735 8206992: Update Graal
iveresov
parents: 50858
diff changeset
    33
import org.graalvm.compiler.asm.amd64.AMD64Assembler.VexRMOp;
091c0d22e735 8206992: Update Graal
iveresov
parents: 50858
diff changeset
    34
import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
091c0d22e735 8206992: Update Graal
iveresov
parents: 50858
diff changeset
    35
import org.graalvm.compiler.asm.amd64.AVXKind.AVXSize;
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    36
import org.graalvm.compiler.lir.LIRInstructionClass;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    37
import org.graalvm.compiler.lir.Opcode;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    38
import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    39
51436
091c0d22e735 8206992: Update Graal
iveresov
parents: 50858
diff changeset
    40
import jdk.vm.ci.meta.AllocatableValue;
091c0d22e735 8206992: Update Graal
iveresov
parents: 50858
diff changeset
    41
59095
03fbcd06b4c0 8233841: Update Graal
dlong
parents: 58299
diff changeset
    42
public final class AMD64VectorCompareOp extends AMD64VectorInstruction {
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    43
    public static final LIRInstructionClass<AMD64VectorCompareOp> TYPE = LIRInstructionClass.create(AMD64VectorCompareOp.class);
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    44
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    45
    @Opcode private final VexRMOp opcode;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    46
    @Use({REG}) protected AllocatableValue x;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    47
    @Use({REG, STACK}) protected AllocatableValue y;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    48
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    49
    public AMD64VectorCompareOp(VexRMOp opcode, AllocatableValue x, AllocatableValue y) {
58299
6df94ce3ab2f 8229201: Update Graal
dlong
parents: 51436
diff changeset
    50
        this(opcode, AVXSize.XMM, x, y);
6df94ce3ab2f 8229201: Update Graal
dlong
parents: 51436
diff changeset
    51
    }
6df94ce3ab2f 8229201: Update Graal
dlong
parents: 51436
diff changeset
    52
6df94ce3ab2f 8229201: Update Graal
dlong
parents: 51436
diff changeset
    53
    public AMD64VectorCompareOp(VexRMOp opcode, AVXSize size, AllocatableValue x, AllocatableValue y) {
59095
03fbcd06b4c0 8233841: Update Graal
dlong
parents: 58299
diff changeset
    54
        super(TYPE, size);
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    55
        this.opcode = opcode;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    56
        this.x = x;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    57
        this.y = y;
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    58
    }
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    59
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    60
    @Override
51436
091c0d22e735 8206992: Update Graal
iveresov
parents: 50858
diff changeset
    61
    public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    62
        if (isRegister(y)) {
58299
6df94ce3ab2f 8229201: Update Graal
dlong
parents: 51436
diff changeset
    63
            opcode.emit(masm, size, asRegister(x), asRegister(y));
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    64
        } else {
58299
6df94ce3ab2f 8229201: Update Graal
dlong
parents: 51436
diff changeset
    65
            opcode.emit(masm, size, asRegister(x), (AMD64Address) crb.asAddress(y));
50609
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    66
        }
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    67
    }
bf414874c28f 8204231: Update Graal
dlong
parents:
diff changeset
    68
}