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