src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64Assembler.java
changeset 58877 aec7bf35d6f5
parent 58299 6df94ce3ab2f
equal deleted inserted replaced
58876:1a8d65e71a66 58877:aec7bf35d6f5
   469     private static final int ShiftTypeOffset = 22;
   469     private static final int ShiftTypeOffset = 22;
   470 
   470 
   471     private static final int AddSubExtendedOp = 0x0B200000;
   471     private static final int AddSubExtendedOp = 0x0B200000;
   472 
   472 
   473     private static final int MulOp = 0x1B000000;
   473     private static final int MulOp = 0x1B000000;
       
   474     private static final int SignedMulLongOp = 0x9B200000;
   474     private static final int DataProcessing1SourceOp = 0x5AC00000;
   475     private static final int DataProcessing1SourceOp = 0x5AC00000;
   475     private static final int DataProcessing2SourceOp = 0x1AC00000;
   476     private static final int DataProcessing2SourceOp = 0x1AC00000;
   476 
   477 
   477     private static final int Fp1SourceOp = 0x1E204000;
   478     private static final int Fp1SourceOp = 0x1E204000;
   478     private static final int Fp2SourceOp = 0x1E200800;
   479     private static final int Fp2SourceOp = 0x1E200800;
  2311         assert !src2.equals(sp);
  2312         assert !src2.equals(sp);
  2312         emitInt(0b10011011010 << 21 | dst.encoding | rs1(src1) | rs2(src2) | 0b011111 << ImmediateOffset);
  2313         emitInt(0b10011011010 << 21 | dst.encoding | rs1(src1) | rs2(src2) | 0b011111 << ImmediateOffset);
  2313     }
  2314     }
  2314 
  2315 
  2315     /**
  2316     /**
  2316      * unsigned multiply high. dst = (src1 * src2)[127:64]
  2317      * Unsigned multiply high. dst = (src1 * src2)[127:64]
  2317      *
  2318      *
  2318      * @param dst general purpose register. May not be null or the stackpointer.
  2319      * @param dst general purpose register. May not be null or the stackpointer.
  2319      * @param src1 general purpose register. May not be null or the stackpointer.
  2320      * @param src1 general purpose register. May not be null or the stackpointer.
  2320      * @param src2 general purpose register. May not be null or the stackpointer.
  2321      * @param src2 general purpose register. May not be null or the stackpointer.
  2321      */
  2322      */
  2325         assert !src2.equals(sp);
  2326         assert !src2.equals(sp);
  2326         emitInt(0b10011011110 << 21 | dst.encoding | rs1(src1) | rs2(src2) | 0b011111 << ImmediateOffset);
  2327         emitInt(0b10011011110 << 21 | dst.encoding | rs1(src1) | rs2(src2) | 0b011111 << ImmediateOffset);
  2327     }
  2328     }
  2328 
  2329 
  2329     /**
  2330     /**
  2330      * unsigned multiply add-long. xDst = xSrc3 + (wSrc1 * wSrc2)
  2331      * Unsigned multiply add-long. xDst = xSrc3 + (wSrc1 * wSrc2)
  2331      *
  2332      *
  2332      * @param dst general purpose register. May not be null or the stackpointer.
  2333      * @param dst general purpose register. May not be null or the stackpointer.
  2333      * @param src1 general purpose register. May not be null or the stackpointer.
  2334      * @param src1 general purpose register. May not be null or the stackpointer.
  2334      * @param src2 general purpose register. May not be null or the stackpointer.
  2335      * @param src2 general purpose register. May not be null or the stackpointer.
  2335      * @param src3 general purpose register. May not be null or the stackpointer.
  2336      * @param src3 general purpose register. May not be null or the stackpointer.
  2341         assert !src3.equals(sp);
  2342         assert !src3.equals(sp);
  2342         emitInt(0b10011011101 << 21 | dst.encoding | rs1(src1) | rs2(src2) | 0b011111 << ImmediateOffset);
  2343         emitInt(0b10011011101 << 21 | dst.encoding | rs1(src1) | rs2(src2) | 0b011111 << ImmediateOffset);
  2343     }
  2344     }
  2344 
  2345 
  2345     /**
  2346     /**
  2346      * signed multiply add-long. xDst = xSrc3 + (wSrc1 * wSrc2)
  2347      * Signed multiply-add long. xDst = xSrc3 + (wSrc1 * wSrc2)
  2347      *
  2348      *
  2348      * @param dst general purpose register. May not be null or the stackpointer.
  2349      * @param dst general purpose register. May not be null or the stackpointer.
  2349      * @param src1 general purpose register. May not be null or the stackpointer.
  2350      * @param src1 general purpose register. May not be null or the stackpointer.
  2350      * @param src2 general purpose register. May not be null or the stackpointer.
  2351      * @param src2 general purpose register. May not be null or the stackpointer.
  2351      * @param src3 general purpose register. May not be null or the stackpointer.
  2352      * @param src3 general purpose register. May not be null or the stackpointer.
  2352      */
  2353      */
  2353     public void smaddl(Register dst, Register src1, Register src2, Register src3) {
  2354     public void smaddl(Register dst, Register src1, Register src2, Register src3) {
  2354         assert !dst.equals(sp);
  2355         smullInstruction(MADD, dst, src1, src2, src3);
  2355         assert !src1.equals(sp);
  2356     }
  2356         assert !src2.equals(sp);
  2357 
  2357         assert !src3.equals(sp);
  2358     /**
  2358         emitInt(0b10011011001 << 21 | dst.encoding | rs1(src1) | rs2(src2) | rs3(src3));
  2359      * Signed multiply-sub long. xDst = xSrc3 - (wSrc1 * wSrc2)
       
  2360      *
       
  2361      * @param dst general purpose register. May not be null or the stackpointer.
       
  2362      * @param src1 general purpose register. May not be null or the stackpointer.
       
  2363      * @param src2 general purpose register. May not be null or the stackpointer.
       
  2364      * @param src3 general purpose register. May not be null or the stackpointer.
       
  2365      */
       
  2366     public void smsubl(Register dst, Register src1, Register src2, Register src3) {
       
  2367         smullInstruction(MSUB, dst, src1, src2, src3);
  2359     }
  2368     }
  2360 
  2369 
  2361     private void mulInstruction(Instruction instr, Register dst, Register src1, Register src2, Register src3, InstructionType type) {
  2370     private void mulInstruction(Instruction instr, Register dst, Register src1, Register src2, Register src3, InstructionType type) {
  2362         assert !dst.equals(sp);
  2371         assert !dst.equals(sp);
  2363         assert !src1.equals(sp);
  2372         assert !src1.equals(sp);
  2364         assert !src2.equals(sp);
  2373         assert !src2.equals(sp);
  2365         assert !src3.equals(sp);
  2374         assert !src3.equals(sp);
  2366         emitInt(type.encoding | instr.encoding | MulOp | rd(dst) | rs1(src1) | rs2(src2) | rs3(src3));
  2375         emitInt(type.encoding | instr.encoding | MulOp | rd(dst) | rs1(src1) | rs2(src2) | rs3(src3));
       
  2376     }
       
  2377 
       
  2378     private void smullInstruction(Instruction instr, Register dst, Register src1, Register src2, Register src3) {
       
  2379         assert !dst.equals(sp);
       
  2380         assert !src1.equals(sp);
       
  2381         assert !src2.equals(sp);
       
  2382         assert !src3.equals(sp);
       
  2383         emitInt(instr.encoding | SignedMulLongOp | rd(dst) | rs1(src1) | rs2(src2) | rs3(src3));
  2367     }
  2384     }
  2368 
  2385 
  2369     /**
  2386     /**
  2370      * Signed divide. dst = src1 / src2.
  2387      * Signed divide. dst = src1 / src2.
  2371      *
  2388      *