< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64ArrayEqualsOp.java

Print this page
rev 52509 : [mq]: graal2


  47  * Emits code which compares two arrays of the same length. If the CPU supports any vector
  48  * instructions specialized code is emitted to leverage these instructions.
  49  */
  50 @Opcode("ARRAY_EQUALS")
  51 public final class AArch64ArrayEqualsOp extends AArch64LIRInstruction {
  52     public static final LIRInstructionClass<AArch64ArrayEqualsOp> TYPE = LIRInstructionClass.create(AArch64ArrayEqualsOp.class);
  53 
  54     private final JavaKind kind;
  55     private final int arrayBaseOffset;
  56     private final int arrayIndexScale;
  57 
  58     @Def({REG}) protected Value resultValue;
  59     @Alive({REG}) protected Value array1Value;
  60     @Alive({REG}) protected Value array2Value;
  61     @Alive({REG}) protected Value lengthValue;
  62     @Temp({REG}) protected Value temp1;
  63     @Temp({REG}) protected Value temp2;
  64     @Temp({REG}) protected Value temp3;
  65     @Temp({REG}) protected Value temp4;
  66 
  67     public AArch64ArrayEqualsOp(LIRGeneratorTool tool, JavaKind kind, Value result, Value array1, Value array2, Value length) {
  68         super(TYPE);
  69 
  70         assert !kind.isNumericFloat() : "Float arrays comparison (bitwise_equal || both_NaN) isn't supported";
  71         this.kind = kind;
  72 
  73         this.arrayBaseOffset = tool.getProviders().getArrayOffsetProvider().arrayBaseOffset(kind);
  74         this.arrayIndexScale = tool.getProviders().getArrayOffsetProvider().arrayScalingFactor(kind);
  75 
  76         this.resultValue = result;
  77         this.array1Value = array1;
  78         this.array2Value = array2;
  79         this.lengthValue = length;
  80 
  81         // Allocate some temporaries.
  82         this.temp1 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
  83         this.temp2 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
  84         this.temp3 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
  85         this.temp4 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
  86     }
  87 
  88     @Override
  89     public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
  90         Register result = asRegister(resultValue);
  91         Register array1 = asRegister(temp1);
  92         Register array2 = asRegister(temp2);
  93         Register length = asRegister(temp3);
  94 




  47  * Emits code which compares two arrays of the same length. If the CPU supports any vector
  48  * instructions specialized code is emitted to leverage these instructions.
  49  */
  50 @Opcode("ARRAY_EQUALS")
  51 public final class AArch64ArrayEqualsOp extends AArch64LIRInstruction {
  52     public static final LIRInstructionClass<AArch64ArrayEqualsOp> TYPE = LIRInstructionClass.create(AArch64ArrayEqualsOp.class);
  53 
  54     private final JavaKind kind;
  55     private final int arrayBaseOffset;
  56     private final int arrayIndexScale;
  57 
  58     @Def({REG}) protected Value resultValue;
  59     @Alive({REG}) protected Value array1Value;
  60     @Alive({REG}) protected Value array2Value;
  61     @Alive({REG}) protected Value lengthValue;
  62     @Temp({REG}) protected Value temp1;
  63     @Temp({REG}) protected Value temp2;
  64     @Temp({REG}) protected Value temp3;
  65     @Temp({REG}) protected Value temp4;
  66 
  67     public AArch64ArrayEqualsOp(LIRGeneratorTool tool, JavaKind kind, Value result, Value array1, Value array2, Value length, boolean directPointers) {
  68         super(TYPE);
  69 
  70         assert !kind.isNumericFloat() : "Float arrays comparison (bitwise_equal || both_NaN) isn't supported";
  71         this.kind = kind;
  72 
  73         this.arrayBaseOffset = directPointers ? 0 : tool.getProviders().getMetaAccess().getArrayBaseOffset(kind);
  74         this.arrayIndexScale = tool.getProviders().getMetaAccess().getArrayIndexScale(kind);
  75 
  76         this.resultValue = result;
  77         this.array1Value = array1;
  78         this.array2Value = array2;
  79         this.lengthValue = length;
  80 
  81         // Allocate some temporaries.
  82         this.temp1 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
  83         this.temp2 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
  84         this.temp3 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
  85         this.temp4 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
  86     }
  87 
  88     @Override
  89     public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
  90         Register result = asRegister(resultValue);
  91         Register array1 = asRegister(temp1);
  92         Register array2 = asRegister(temp2);
  93         Register length = asRegister(temp3);
  94 


< prev index next >