mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-15 08:34:30 +02:00
8252204: AArch64: Implement SHA3 accelerator/intrinsic
Co-authored-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Co-authored-by: Dong Bo <dongbo4@huawei.com> Reviewed-by: aph, kvn
This commit is contained in:
parent
7d3d4daefd
commit
b25d894015
36 changed files with 1243 additions and 255 deletions
|
@ -1110,6 +1110,44 @@ class SHA512SIMDOp(Instruction):
|
|||
+ ('\t%s, %s, %s.2D' % (self.reg[0].astr("q"),
|
||||
self.reg[1].astr("q"), self.reg[2].astr("v"))))
|
||||
|
||||
class SHA3SIMDOp(Instruction):
|
||||
|
||||
def generate(self):
|
||||
if ((self._name == 'eor3') or (self._name == 'bcax')):
|
||||
self.reg = [FloatRegister().generate(), FloatRegister().generate(),
|
||||
FloatRegister().generate(), FloatRegister().generate()]
|
||||
else:
|
||||
self.reg = [FloatRegister().generate(), FloatRegister().generate(),
|
||||
FloatRegister().generate()]
|
||||
if (self._name == 'xar'):
|
||||
self.imm6 = random.randint(0, 63)
|
||||
return self
|
||||
|
||||
def cstr(self):
|
||||
if ((self._name == 'eor3') or (self._name == 'bcax')):
|
||||
return (super(SHA3SIMDOp, self).cstr()
|
||||
+ ('%s, __ T16B, %s, %s, %s);' % (self.reg[0], self.reg[1], self.reg[2], self.reg[3])))
|
||||
elif (self._name == 'rax1'):
|
||||
return (super(SHA3SIMDOp, self).cstr()
|
||||
+ ('%s, __ T2D, %s, %s);' % (self.reg[0], self.reg[1], self.reg[2])))
|
||||
else:
|
||||
return (super(SHA3SIMDOp, self).cstr()
|
||||
+ ('%s, __ T2D, %s, %s, %s);' % (self.reg[0], self.reg[1], self.reg[2], self.imm6)))
|
||||
|
||||
def astr(self):
|
||||
if ((self._name == 'eor3') or (self._name == 'bcax')):
|
||||
return (super(SHA3SIMDOp, self).astr()
|
||||
+ ('\t%s.16B, %s.16B, %s.16B, %s.16B' % (self.reg[0].astr("v"), self.reg[1].astr("v"),
|
||||
self.reg[2].astr("v"), self.reg[3].astr("v"))))
|
||||
elif (self._name == 'rax1'):
|
||||
return (super(SHA3SIMDOp, self).astr()
|
||||
+ ('\t%s.2D, %s.2D, %s.2D') % (self.reg[0].astr("v"), self.reg[1].astr("v"),
|
||||
self.reg[2].astr("v")))
|
||||
else:
|
||||
return (super(SHA3SIMDOp, self).astr()
|
||||
+ ('\t%s.2D, %s.2D, %s.2D, #%s') % (self.reg[0].astr("v"), self.reg[1].astr("v"),
|
||||
self.reg[2].astr("v"), self.imm6))
|
||||
|
||||
class LSEOp(Instruction):
|
||||
def __init__(self, args):
|
||||
self._name, self.asmname, self.size, self.suffix = args
|
||||
|
@ -1441,8 +1479,6 @@ generate(ThreeRegNEONOp,
|
|||
["fcmge", "fcmge", "2D"],
|
||||
])
|
||||
|
||||
generate(SHA512SIMDOp, ["sha512h", "sha512h2", "sha512su0", "sha512su1"])
|
||||
|
||||
generate(SpecialCases, [["ccmn", "__ ccmn(zr, zr, 3u, Assembler::LE);", "ccmn\txzr, xzr, #3, LE"],
|
||||
["ccmnw", "__ ccmnw(zr, zr, 5u, Assembler::EQ);", "ccmn\twzr, wzr, #5, EQ"],
|
||||
["ccmp", "__ ccmp(zr, 1, 4u, Assembler::NE);", "ccmp\txzr, 1, #4, NE"],
|
||||
|
@ -1517,6 +1553,11 @@ for size in ("x", "w"):
|
|||
["ldumin", "ldumin", size, suffix],
|
||||
["ldumax", "ldumax", size, suffix]]);
|
||||
|
||||
# ARMv8.2A
|
||||
generate(SHA3SIMDOp, ["bcax", "eor3", "rax1", "xar"])
|
||||
|
||||
generate(SHA512SIMDOp, ["sha512h", "sha512h2", "sha512su0", "sha512su1"])
|
||||
|
||||
generate(SVEVectorOp, [["add", "ZZZ"],
|
||||
["sub", "ZZZ"],
|
||||
["fadd", "ZZZ"],
|
||||
|
@ -1565,8 +1606,8 @@ outfile.write("forth:\n")
|
|||
|
||||
outfile.close()
|
||||
|
||||
# compile for sve with 8.1 and sha2 because of lse atomics and sha512 crypto extension.
|
||||
subprocess.check_call([AARCH64_AS, "-march=armv8.1-a+sha2+sve", "aarch64ops.s", "-o", "aarch64ops.o"])
|
||||
# compile for sve with 8.2 and sha3 because of SHA3 crypto extension.
|
||||
subprocess.check_call([AARCH64_AS, "-march=armv8.2-a+sha3+sve", "aarch64ops.s", "-o", "aarch64ops.o"])
|
||||
|
||||
print
|
||||
print "/*"
|
||||
|
|
|
@ -755,12 +755,6 @@ void entry(CodeBuffer *cb) {
|
|||
__ fcmge(v22, __ T4S, v23, v24); // fcmge v22.4S, v23.4S, v24.4S
|
||||
__ fcmge(v17, __ T2D, v18, v19); // fcmge v17.2D, v18.2D, v19.2D
|
||||
|
||||
// SHA512SIMDOp
|
||||
__ sha512h(v13, __ T2D, v4, v28); // sha512h q13, q4, v28.2D
|
||||
__ sha512h2(v23, __ T2D, v21, v25); // sha512h2 q23, q21, v25.2D
|
||||
__ sha512su0(v24, __ T2D, v3); // sha512su0 v24.2D, v3.2D
|
||||
__ sha512su1(v23, __ T2D, v26, v23); // sha512su1 v23.2D, v26.2D, v23.2D
|
||||
|
||||
// SpecialCases
|
||||
__ ccmn(zr, zr, 3u, Assembler::LE); // ccmn xzr, xzr, #3, LE
|
||||
__ ccmnw(zr, zr, 5u, Assembler::EQ); // ccmn wzr, wzr, #5, EQ
|
||||
|
@ -846,143 +840,155 @@ void entry(CodeBuffer *cb) {
|
|||
__ fmovd(v0, -1.0625); // fmov d0, #-1.0625
|
||||
|
||||
// LSEOp
|
||||
__ swp(Assembler::xword, r15, r21, r3); // swp x15, x21, [x3]
|
||||
__ ldadd(Assembler::xword, r24, r8, r25); // ldadd x24, x8, [x25]
|
||||
__ ldbic(Assembler::xword, r20, r16, r17); // ldclr x20, x16, [x17]
|
||||
__ ldeor(Assembler::xword, r2, r1, r0); // ldeor x2, x1, [x0]
|
||||
__ ldorr(Assembler::xword, r24, r4, r3); // ldset x24, x4, [x3]
|
||||
__ ldsmin(Assembler::xword, r12, zr, r28); // ldsmin x12, xzr, [x28]
|
||||
__ ldsmax(Assembler::xword, r10, r26, r2); // ldsmax x10, x26, [x2]
|
||||
__ ldumin(Assembler::xword, r12, r16, sp); // ldumin x12, x16, [sp]
|
||||
__ ldumax(Assembler::xword, r1, r13, r29); // ldumax x1, x13, [x29]
|
||||
__ swp(Assembler::xword, r13, r5, r29); // swp x13, x5, [x29]
|
||||
__ ldadd(Assembler::xword, r24, r21, r26); // ldadd x24, x21, [x26]
|
||||
__ ldbic(Assembler::xword, r24, r3, r24); // ldclr x24, x3, [x24]
|
||||
__ ldeor(Assembler::xword, r26, r23, r15); // ldeor x26, x23, [x15]
|
||||
__ ldorr(Assembler::xword, r21, r3, r24); // ldset x21, x3, [x24]
|
||||
__ ldsmin(Assembler::xword, r8, r25, r20); // ldsmin x8, x25, [x20]
|
||||
__ ldsmax(Assembler::xword, r16, r17, r2); // ldsmax x16, x17, [x2]
|
||||
__ ldumin(Assembler::xword, r1, r0, r24); // ldumin x1, x0, [x24]
|
||||
__ ldumax(Assembler::xword, r4, r3, r12); // ldumax x4, x3, [x12]
|
||||
|
||||
// LSEOp
|
||||
__ swpa(Assembler::xword, r0, r19, r12); // swpa x0, x19, [x12]
|
||||
__ ldadda(Assembler::xword, r17, r22, r13); // ldadda x17, x22, [x13]
|
||||
__ ldbica(Assembler::xword, r28, r30, sp); // ldclra x28, x30, [sp]
|
||||
__ ldeora(Assembler::xword, r1, r26, r28); // ldeora x1, x26, [x28]
|
||||
__ ldorra(Assembler::xword, r4, r30, r4); // ldseta x4, x30, [x4]
|
||||
__ ldsmina(Assembler::xword, r6, r30, r26); // ldsmina x6, x30, [x26]
|
||||
__ ldsmaxa(Assembler::xword, r16, r9, r8); // ldsmaxa x16, x9, [x8]
|
||||
__ ldumina(Assembler::xword, r12, r0, r20); // ldumina x12, x0, [x20]
|
||||
__ ldumaxa(Assembler::xword, r1, r24, r2); // ldumaxa x1, x24, [x2]
|
||||
__ swpa(Assembler::xword, zr, r28, r10); // swpa xzr, x28, [x10]
|
||||
__ ldadda(Assembler::xword, r26, r2, r12); // ldadda x26, x2, [x12]
|
||||
__ ldbica(Assembler::xword, r16, zr, r1); // ldclra x16, xzr, [x1]
|
||||
__ ldeora(Assembler::xword, r13, r29, r0); // ldeora x13, x29, [x0]
|
||||
__ ldorra(Assembler::xword, r19, r12, r17); // ldseta x19, x12, [x17]
|
||||
__ ldsmina(Assembler::xword, r22, r13, r28); // ldsmina x22, x13, [x28]
|
||||
__ ldsmaxa(Assembler::xword, r30, zr, r1); // ldsmaxa x30, xzr, [x1]
|
||||
__ ldumina(Assembler::xword, r26, r28, r4); // ldumina x26, x28, [x4]
|
||||
__ ldumaxa(Assembler::xword, r30, r4, r6); // ldumaxa x30, x4, [x6]
|
||||
|
||||
// LSEOp
|
||||
__ swpal(Assembler::xword, r0, r9, r24); // swpal x0, x9, [x24]
|
||||
__ ldaddal(Assembler::xword, r26, r16, r30); // ldaddal x26, x16, [x30]
|
||||
__ ldbical(Assembler::xword, r3, r10, r23); // ldclral x3, x10, [x23]
|
||||
__ ldeoral(Assembler::xword, r10, r4, r15); // ldeoral x10, x4, [x15]
|
||||
__ ldorral(Assembler::xword, r2, r11, r8); // ldsetal x2, x11, [x8]
|
||||
__ ldsminal(Assembler::xword, r10, r15, r17); // ldsminal x10, x15, [x17]
|
||||
__ ldsmaxal(Assembler::xword, r2, r10, r12); // ldsmaxal x2, x10, [x12]
|
||||
__ lduminal(Assembler::xword, r12, r15, r13); // lduminal x12, x15, [x13]
|
||||
__ ldumaxal(Assembler::xword, r2, r7, r20); // ldumaxal x2, x7, [x20]
|
||||
__ swpal(Assembler::xword, r30, r26, r15); // swpal x30, x26, [x15]
|
||||
__ ldaddal(Assembler::xword, r9, r8, r12); // ldaddal x9, x8, [x12]
|
||||
__ ldbical(Assembler::xword, r0, r20, r1); // ldclral x0, x20, [x1]
|
||||
__ ldeoral(Assembler::xword, r24, r2, r0); // ldeoral x24, x2, [x0]
|
||||
__ ldorral(Assembler::xword, r9, r24, r26); // ldsetal x9, x24, [x26]
|
||||
__ ldsminal(Assembler::xword, r16, r30, r3); // ldsminal x16, x30, [x3]
|
||||
__ ldsmaxal(Assembler::xword, r10, r23, r10); // ldsmaxal x10, x23, [x10]
|
||||
__ lduminal(Assembler::xword, r4, r16, r2); // lduminal x4, x16, [x2]
|
||||
__ ldumaxal(Assembler::xword, r11, r8, r10); // ldumaxal x11, x8, [x10]
|
||||
|
||||
// LSEOp
|
||||
__ swpl(Assembler::xword, r26, r16, r4); // swpl x26, x16, [x4]
|
||||
__ ldaddl(Assembler::xword, r2, r4, r12); // ldaddl x2, x4, [x12]
|
||||
__ ldbicl(Assembler::xword, r16, r21, r16); // ldclrl x16, x21, [x16]
|
||||
__ ldeorl(Assembler::xword, r16, r11, r21); // ldeorl x16, x11, [x21]
|
||||
__ ldorrl(Assembler::xword, r23, r12, r26); // ldsetl x23, x12, [x26]
|
||||
__ ldsminl(Assembler::xword, r23, r28, r14); // ldsminl x23, x28, [x14]
|
||||
__ ldsmaxl(Assembler::xword, r11, r24, r1); // ldsmaxl x11, x24, [x1]
|
||||
__ lduminl(Assembler::xword, r12, zr, r10); // lduminl x12, xzr, [x10]
|
||||
__ ldumaxl(Assembler::xword, r16, r7, r2); // ldumaxl x16, x7, [x2]
|
||||
__ swpl(Assembler::xword, r15, r17, r2); // swpl x15, x17, [x2]
|
||||
__ ldaddl(Assembler::xword, r10, r12, r12); // ldaddl x10, x12, [x12]
|
||||
__ ldbicl(Assembler::xword, r15, r13, r2); // ldclrl x15, x13, [x2]
|
||||
__ ldeorl(Assembler::xword, r7, r20, r26); // ldeorl x7, x20, [x26]
|
||||
__ ldorrl(Assembler::xword, r16, r4, r2); // ldsetl x16, x4, [x2]
|
||||
__ ldsminl(Assembler::xword, r4, r12, r15); // ldsminl x4, x12, [x15]
|
||||
__ ldsmaxl(Assembler::xword, r21, r16, r15); // ldsmaxl x21, x16, [x15]
|
||||
__ lduminl(Assembler::xword, r11, r21, r23); // lduminl x11, x21, [x23]
|
||||
__ ldumaxl(Assembler::xword, r12, r26, r23); // ldumaxl x12, x26, [x23]
|
||||
|
||||
// LSEOp
|
||||
__ swp(Assembler::word, r3, r13, r19); // swp w3, w13, [x19]
|
||||
__ ldadd(Assembler::word, r17, r16, r3); // ldadd w17, w16, [x3]
|
||||
__ ldbic(Assembler::word, r1, r11, r30); // ldclr w1, w11, [x30]
|
||||
__ ldeor(Assembler::word, r5, r8, r15); // ldeor w5, w8, [x15]
|
||||
__ ldorr(Assembler::word, r29, r30, r0); // ldset w29, w30, [x0]
|
||||
__ ldsmin(Assembler::word, r20, r7, r20); // ldsmin w20, w7, [x20]
|
||||
__ ldsmax(Assembler::word, r23, r28, r21); // ldsmax w23, w28, [x21]
|
||||
__ ldumin(Assembler::word, r27, r25, r5); // ldumin w27, w25, [x5]
|
||||
__ ldumax(Assembler::word, r1, r23, r16); // ldumax w1, w23, [x16]
|
||||
__ swp(Assembler::word, r28, r14, r11); // swp w28, w14, [x11]
|
||||
__ ldadd(Assembler::word, r24, r1, r12); // ldadd w24, w1, [x12]
|
||||
__ ldbic(Assembler::word, zr, r10, r16); // ldclr wzr, w10, [x16]
|
||||
__ ldeor(Assembler::word, r7, r2, r3); // ldeor w7, w2, [x3]
|
||||
__ ldorr(Assembler::word, r13, r19, r17); // ldset w13, w19, [x17]
|
||||
__ ldsmin(Assembler::word, r16, r3, r1); // ldsmin w16, w3, [x1]
|
||||
__ ldsmax(Assembler::word, r11, r30, r5); // ldsmax w11, w30, [x5]
|
||||
__ ldumin(Assembler::word, r8, r15, r29); // ldumin w8, w15, [x29]
|
||||
__ ldumax(Assembler::word, r30, r0, r20); // ldumax w30, w0, [x20]
|
||||
|
||||
// LSEOp
|
||||
__ swpa(Assembler::word, zr, r5, r12); // swpa wzr, w5, [x12]
|
||||
__ ldadda(Assembler::word, r9, r28, r15); // ldadda w9, w28, [x15]
|
||||
__ ldbica(Assembler::word, r29, r22, sp); // ldclra w29, w22, [sp]
|
||||
__ ldeora(Assembler::word, r19, zr, r5); // ldeora w19, wzr, [x5]
|
||||
__ ldorra(Assembler::word, r14, r16, sp); // ldseta w14, w16, [sp]
|
||||
__ ldsmina(Assembler::word, r16, r27, r20); // ldsmina w16, w27, [x20]
|
||||
__ ldsmaxa(Assembler::word, r16, r12, r11); // ldsmaxa w16, w12, [x11]
|
||||
__ ldumina(Assembler::word, r9, r6, r30); // ldumina w9, w6, [x30]
|
||||
__ ldumaxa(Assembler::word, r17, r27, r28); // ldumaxa w17, w27, [x28]
|
||||
__ swpa(Assembler::word, r7, r20, r23); // swpa w7, w20, [x23]
|
||||
__ ldadda(Assembler::word, r28, r21, r27); // ldadda w28, w21, [x27]
|
||||
__ ldbica(Assembler::word, r25, r5, r1); // ldclra w25, w5, [x1]
|
||||
__ ldeora(Assembler::word, r23, r16, sp); // ldeora w23, w16, [sp]
|
||||
__ ldorra(Assembler::word, r5, r12, r9); // ldseta w5, w12, [x9]
|
||||
__ ldsmina(Assembler::word, r28, r15, r29); // ldsmina w28, w15, [x29]
|
||||
__ ldsmaxa(Assembler::word, r22, zr, r19); // ldsmaxa w22, wzr, [x19]
|
||||
__ ldumina(Assembler::word, zr, r5, r14); // ldumina wzr, w5, [x14]
|
||||
__ ldumaxa(Assembler::word, r16, zr, r15); // ldumaxa w16, wzr, [x15]
|
||||
|
||||
// LSEOp
|
||||
__ swpal(Assembler::word, r30, r7, r10); // swpal w30, w7, [x10]
|
||||
__ ldaddal(Assembler::word, r20, r10, r4); // ldaddal w20, w10, [x4]
|
||||
__ ldbical(Assembler::word, r24, r17, r17); // ldclral w24, w17, [x17]
|
||||
__ ldeoral(Assembler::word, r22, r3, r29); // ldeoral w22, w3, [x29]
|
||||
__ ldorral(Assembler::word, r15, r22, r19); // ldsetal w15, w22, [x19]
|
||||
__ ldsminal(Assembler::word, r19, r22, r2); // ldsminal w19, w22, [x2]
|
||||
__ ldsmaxal(Assembler::word, r15, r6, r12); // ldsmaxal w15, w6, [x12]
|
||||
__ lduminal(Assembler::word, r16, r11, r13); // lduminal w16, w11, [x13]
|
||||
__ ldumaxal(Assembler::word, r23, r1, r30); // ldumaxal w23, w1, [x30]
|
||||
__ swpal(Assembler::word, r27, r20, r16); // swpal w27, w20, [x16]
|
||||
__ ldaddal(Assembler::word, r12, r11, r9); // ldaddal w12, w11, [x9]
|
||||
__ ldbical(Assembler::word, r6, r30, r17); // ldclral w6, w30, [x17]
|
||||
__ ldeoral(Assembler::word, r27, r28, r30); // ldeoral w27, w28, [x30]
|
||||
__ ldorral(Assembler::word, r7, r10, r20); // ldsetal w7, w10, [x20]
|
||||
__ ldsminal(Assembler::word, r10, r4, r24); // ldsminal w10, w4, [x24]
|
||||
__ ldsmaxal(Assembler::word, r17, r17, r22); // ldsmaxal w17, w17, [x22]
|
||||
__ lduminal(Assembler::word, r3, r29, r15); // lduminal w3, w29, [x15]
|
||||
__ ldumaxal(Assembler::word, r22, r19, r19); // ldumaxal w22, w19, [x19]
|
||||
|
||||
// LSEOp
|
||||
__ swpl(Assembler::word, r19, r5, r17); // swpl w19, w5, [x17]
|
||||
__ ldaddl(Assembler::word, r2, r16, r22); // ldaddl w2, w16, [x22]
|
||||
__ ldbicl(Assembler::word, r13, r10, r21); // ldclrl w13, w10, [x21]
|
||||
__ ldeorl(Assembler::word, r29, r27, r12); // ldeorl w29, w27, [x12]
|
||||
__ ldorrl(Assembler::word, r27, r3, r1); // ldsetl w27, w3, [x1]
|
||||
__ ldsminl(Assembler::word, zr, r24, r19); // ldsminl wzr, w24, [x19]
|
||||
__ ldsmaxl(Assembler::word, r17, r9, r28); // ldsmaxl w17, w9, [x28]
|
||||
__ lduminl(Assembler::word, r27, r15, r7); // lduminl w27, w15, [x7]
|
||||
__ ldumaxl(Assembler::word, r21, r23, sp); // ldumaxl w21, w23, [sp]
|
||||
__ swpl(Assembler::word, r22, r2, r15); // swpl w22, w2, [x15]
|
||||
__ ldaddl(Assembler::word, r6, r12, r16); // ldaddl w6, w12, [x16]
|
||||
__ ldbicl(Assembler::word, r11, r13, r23); // ldclrl w11, w13, [x23]
|
||||
__ ldeorl(Assembler::word, r1, r30, r19); // ldeorl w1, w30, [x19]
|
||||
__ ldorrl(Assembler::word, r5, r17, r2); // ldsetl w5, w17, [x2]
|
||||
__ ldsminl(Assembler::word, r16, r22, r13); // ldsminl w16, w22, [x13]
|
||||
__ ldsmaxl(Assembler::word, r10, r21, r29); // ldsmaxl w10, w21, [x29]
|
||||
__ lduminl(Assembler::word, r27, r12, r27); // lduminl w27, w12, [x27]
|
||||
__ ldumaxl(Assembler::word, r3, r1, sp); // ldumaxl w3, w1, [sp]
|
||||
|
||||
// SHA3SIMDOp
|
||||
__ bcax(v23, __ T16B, v19, v17, v9); // bcax v23.16B, v19.16B, v17.16B, v9.16B
|
||||
__ eor3(v27, __ T16B, v26, v14, v6); // eor3 v27.16B, v26.16B, v14.16B, v6.16B
|
||||
__ rax1(v20, __ T2D, v22, v30); // rax1 v20.2D, v22.2D, v30.2D
|
||||
__ xar(v24, __ T2D, v2, v30, 54); // xar v24.2D, v2.2D, v30.2D, #54
|
||||
|
||||
// SHA512SIMDOp
|
||||
__ sha512h(v17, __ T2D, v10, v22); // sha512h q17, q10, v22.2D
|
||||
__ sha512h2(v17, __ T2D, v2, v17); // sha512h2 q17, q2, v17.2D
|
||||
__ sha512su0(v0, __ T2D, v24); // sha512su0 v0.2D, v24.2D
|
||||
__ sha512su1(v25, __ T2D, v22, v2); // sha512su1 v25.2D, v22.2D, v2.2D
|
||||
|
||||
// SVEVectorOp
|
||||
__ sve_add(z24, __ D, z2, z30); // add z24.d, z2.d, z30.d
|
||||
__ sve_sub(z17, __ S, z10, z22); // sub z17.s, z10.s, z22.s
|
||||
__ sve_fadd(z2, __ D, z17, z0); // fadd z2.d, z17.d, z0.d
|
||||
__ sve_fmul(z25, __ D, z22, z2); // fmul z25.d, z22.d, z2.d
|
||||
__ sve_fsub(z12, __ D, z3, z27); // fsub z12.d, z3.d, z27.d
|
||||
__ sve_abs(z28, __ B, p4, z26); // abs z28.b, p4/m, z26.b
|
||||
__ sve_add(z9, __ B, p7, z17); // add z9.b, p7/m, z9.b, z17.b
|
||||
__ sve_asr(z4, __ H, p1, z15); // asr z4.h, p1/m, z4.h, z15.h
|
||||
__ sve_cnt(z22, __ D, p2, z2); // cnt z22.d, p2/m, z2.d
|
||||
__ sve_lsl(z20, __ D, p7, z5); // lsl z20.d, p7/m, z20.d, z5.d
|
||||
__ sve_lsr(z0, __ B, p4, z14); // lsr z0.b, p4/m, z0.b, z14.b
|
||||
__ sve_mul(z25, __ S, p2, z27); // mul z25.s, p2/m, z25.s, z27.s
|
||||
__ sve_neg(z26, __ S, p6, z24); // neg z26.s, p6/m, z24.s
|
||||
__ sve_not(z0, __ S, p1, z6); // not z0.s, p1/m, z6.s
|
||||
__ sve_smax(z0, __ B, p1, z15); // smax z0.b, p1/m, z0.b, z15.b
|
||||
__ sve_smin(z9, __ H, p1, z5); // smin z9.h, p1/m, z9.h, z5.h
|
||||
__ sve_sub(z27, __ S, p1, z20); // sub z27.s, p1/m, z27.s, z20.s
|
||||
__ sve_fabs(z20, __ S, p1, z10); // fabs z20.s, p1/m, z10.s
|
||||
__ sve_fadd(z16, __ D, p7, z6); // fadd z16.d, p7/m, z16.d, z6.d
|
||||
__ sve_fdiv(z2, __ D, p3, z29); // fdiv z2.d, p3/m, z2.d, z29.d
|
||||
__ sve_fmax(z2, __ D, p6, z22); // fmax z2.d, p6/m, z2.d, z22.d
|
||||
__ sve_fmin(z14, __ D, p3, z27); // fmin z14.d, p3/m, z14.d, z27.d
|
||||
__ sve_fmul(z23, __ S, p1, z2); // fmul z23.s, p1/m, z23.s, z2.s
|
||||
__ sve_fneg(z10, __ D, p4, z10); // fneg z10.d, p4/m, z10.d
|
||||
__ sve_frintm(z22, __ D, p3, z3); // frintm z22.d, p3/m, z3.d
|
||||
__ sve_frintn(z16, __ D, p1, z1); // frintn z16.d, p1/m, z1.d
|
||||
__ sve_frintp(z16, __ S, p4, z12); // frintp z16.s, p4/m, z12.s
|
||||
__ sve_fsqrt(z12, __ S, p0, z16); // fsqrt z12.s, p0/m, z16.s
|
||||
__ sve_fsub(z20, __ S, p5, z5); // fsub z20.s, p5/m, z20.s, z5.s
|
||||
__ sve_fmla(z7, __ D, p4, z12, z27); // fmla z7.d, p4/m, z12.d, z27.d
|
||||
__ sve_fmls(z16, __ S, p1, z2, z28); // fmls z16.s, p1/m, z2.s, z28.s
|
||||
__ sve_fnmla(z4, __ S, p1, z17, z19); // fnmla z4.s, p1/m, z17.s, z19.s
|
||||
__ sve_fnmls(z12, __ D, p5, z8, z24); // fnmls z12.d, p5/m, z8.d, z24.d
|
||||
__ sve_mla(z17, __ B, p0, z10, z23); // mla z17.b, p0/m, z10.b, z23.b
|
||||
__ sve_mls(z19, __ B, p7, z13, z16); // mls z19.b, p7/m, z13.b, z16.b
|
||||
__ sve_and(z0, z7, z14); // and z0.d, z7.d, z14.d
|
||||
__ sve_eor(z25, z8, z10); // eor z25.d, z8.d, z10.d
|
||||
__ sve_orr(z20, z22, z27); // orr z20.d, z22.d, z27.d
|
||||
__ sve_add(z17, __ D, z12, z3); // add z17.d, z12.d, z3.d
|
||||
__ sve_sub(z29, __ D, z28, z16); // sub z29.d, z28.d, z16.d
|
||||
__ sve_fadd(z6, __ D, z9, z28); // fadd z6.d, z9.d, z28.d
|
||||
__ sve_fmul(z7, __ S, z4, z7); // fmul z7.s, z4.s, z7.s
|
||||
__ sve_fsub(z9, __ S, z22, z8); // fsub z9.s, z22.s, z8.s
|
||||
__ sve_abs(z27, __ B, p5, z30); // abs z27.b, p5/m, z30.b
|
||||
__ sve_add(z26, __ H, p0, z16); // add z26.h, p0/m, z26.h, z16.h
|
||||
__ sve_asr(z3, __ D, p6, z8); // asr z3.d, p6/m, z3.d, z8.d
|
||||
__ sve_cnt(z21, __ D, p6, z26); // cnt z21.d, p6/m, z26.d
|
||||
__ sve_lsl(z22, __ B, p0, z4); // lsl z22.b, p0/m, z22.b, z4.b
|
||||
__ sve_lsr(z17, __ H, p0, z3); // lsr z17.h, p0/m, z17.h, z3.h
|
||||
__ sve_mul(z1, __ B, p2, z6); // mul z1.b, p2/m, z1.b, z6.b
|
||||
__ sve_neg(z9, __ S, p7, z7); // neg z9.s, p7/m, z7.s
|
||||
__ sve_not(z22, __ H, p5, z5); // not z22.h, p5/m, z5.h
|
||||
__ sve_smax(z8, __ B, p4, z30); // smax z8.b, p4/m, z8.b, z30.b
|
||||
__ sve_smin(z17, __ D, p0, z11); // smin z17.d, p0/m, z17.d, z11.d
|
||||
__ sve_sub(z28, __ S, p0, z26); // sub z28.s, p0/m, z28.s, z26.s
|
||||
__ sve_fabs(z28, __ D, p3, z13); // fabs z28.d, p3/m, z13.d
|
||||
__ sve_fadd(z16, __ S, p6, z5); // fadd z16.s, p6/m, z16.s, z5.s
|
||||
__ sve_fdiv(z13, __ S, p2, z15); // fdiv z13.s, p2/m, z13.s, z15.s
|
||||
__ sve_fmax(z26, __ S, p5, z11); // fmax z26.s, p5/m, z26.s, z11.s
|
||||
__ sve_fmin(z22, __ S, p4, z4); // fmin z22.s, p4/m, z22.s, z4.s
|
||||
__ sve_fmul(z19, __ S, p4, z17); // fmul z19.s, p4/m, z19.s, z17.s
|
||||
__ sve_fneg(z14, __ D, p3, z2); // fneg z14.d, p3/m, z2.d
|
||||
__ sve_frintm(z3, __ S, p5, z23); // frintm z3.s, p5/m, z23.s
|
||||
__ sve_frintn(z6, __ S, p1, z17); // frintn z6.s, p1/m, z17.s
|
||||
__ sve_frintp(z27, __ S, p4, z16); // frintp z27.s, p4/m, z16.s
|
||||
__ sve_fsqrt(z2, __ S, p7, z3); // fsqrt z2.s, p7/m, z3.s
|
||||
__ sve_fsub(z6, __ S, p4, z19); // fsub z6.s, p4/m, z6.s, z19.s
|
||||
__ sve_fmla(z12, __ D, p5, z8, z24); // fmla z12.d, p5/m, z8.d, z24.d
|
||||
__ sve_fmls(z17, __ S, p0, z10, z23); // fmls z17.s, p0/m, z10.s, z23.s
|
||||
__ sve_fnmla(z19, __ S, p7, z13, z16); // fnmla z19.s, p7/m, z13.s, z16.s
|
||||
__ sve_fnmls(z0, __ D, p1, z14, z17); // fnmls z0.d, p1/m, z14.d, z17.d
|
||||
__ sve_mla(z8, __ S, p2, z22, z20); // mla z8.s, p2/m, z22.s, z20.s
|
||||
__ sve_mls(z27, __ S, p0, z3, z15); // mls z27.s, p0/m, z3.s, z15.s
|
||||
__ sve_and(z20, z7, z4); // and z20.d, z7.d, z4.d
|
||||
__ sve_eor(z7, z0, z8); // eor z7.d, z0.d, z8.d
|
||||
__ sve_orr(z19, z22, z4); // orr z19.d, z22.d, z4.d
|
||||
|
||||
// SVEReductionOp
|
||||
__ sve_andv(v3, __ S, p3, z17); // andv s3, p3, z17.s
|
||||
__ sve_orv(v7, __ B, p1, z28); // orv b7, p1, z28.b
|
||||
__ sve_eorv(v0, __ S, p2, z16); // eorv s0, p2, z16.s
|
||||
__ sve_smaxv(v22, __ H, p1, z15); // smaxv h22, p1, z15.h
|
||||
__ sve_sminv(v22, __ B, p2, z25); // sminv b22, p2, z25.b
|
||||
__ sve_fminv(v30, __ D, p4, z13); // fminv d30, p4, z13.d
|
||||
__ sve_fmaxv(v11, __ S, p0, z13); // fmaxv s11, p0, z13.s
|
||||
__ sve_fadda(v20, __ S, p4, z25); // fadda s20, p4, s20, z25.s
|
||||
__ sve_uaddv(v4, __ H, p1, z17); // uaddv d4, p1, z17.h
|
||||
__ sve_andv(v9, __ D, p5, z11); // andv d9, p5, z11.d
|
||||
__ sve_orv(v5, __ H, p7, z16); // orv h5, p7, z16.h
|
||||
__ sve_eorv(v22, __ H, p3, z1); // eorv h22, p3, z1.h
|
||||
__ sve_smaxv(v8, __ D, p5, z16); // smaxv d8, p5, z16.d
|
||||
__ sve_sminv(v15, __ S, p1, z4); // sminv s15, p1, z4.s
|
||||
__ sve_fminv(v8, __ S, p1, z29); // fminv s8, p1, z29.s
|
||||
__ sve_fmaxv(v28, __ D, p4, z29); // fmaxv d28, p4, z29.d
|
||||
__ sve_fadda(v9, __ S, p3, z2); // fadda s9, p3, s9, z2.s
|
||||
__ sve_uaddv(v28, __ B, p0, z7); // uaddv d28, p0, z7.b
|
||||
|
||||
__ bind(forth);
|
||||
|
||||
|
@ -1001,30 +1007,30 @@ void entry(CodeBuffer *cb) {
|
|||
0x9101a1a0, 0xb10a5cc8, 0xd10810aa, 0xf10fd061,
|
||||
0x120cb166, 0x321764bc, 0x52174681, 0x720c0227,
|
||||
0x9241018e, 0xb25a2969, 0xd278b411, 0xf26aad01,
|
||||
0x14000000, 0x17ffffd7, 0x140002c9, 0x94000000,
|
||||
0x97ffffd4, 0x940002c6, 0x3400000a, 0x34fffa2a,
|
||||
0x3400586a, 0x35000008, 0x35fff9c8, 0x35005808,
|
||||
0xb400000b, 0xb4fff96b, 0xb40057ab, 0xb500001d,
|
||||
0xb5fff91d, 0xb500575d, 0x10000013, 0x10fff8b3,
|
||||
0x100056f3, 0x90000013, 0x36300016, 0x3637f836,
|
||||
0x36305676, 0x3758000c, 0x375ff7cc, 0x3758560c,
|
||||
0x14000000, 0x17ffffd7, 0x140002cd, 0x94000000,
|
||||
0x97ffffd4, 0x940002ca, 0x3400000a, 0x34fffa2a,
|
||||
0x340058ea, 0x35000008, 0x35fff9c8, 0x35005888,
|
||||
0xb400000b, 0xb4fff96b, 0xb400582b, 0xb500001d,
|
||||
0xb5fff91d, 0xb50057dd, 0x10000013, 0x10fff8b3,
|
||||
0x10005773, 0x90000013, 0x36300016, 0x3637f836,
|
||||
0x363056f6, 0x3758000c, 0x375ff7cc, 0x3758568c,
|
||||
0x128313a0, 0x528a32c7, 0x7289173b, 0x92ab3acc,
|
||||
0xd2a0bf94, 0xf2c285e8, 0x9358722f, 0x330e652f,
|
||||
0x53067f3b, 0x93577c53, 0xb34a1aac, 0xd35a4016,
|
||||
0x13946c63, 0x93c3dbc8, 0x54000000, 0x54fff5a0,
|
||||
0x540053e0, 0x54000001, 0x54fff541, 0x54005381,
|
||||
0x54000002, 0x54fff4e2, 0x54005322, 0x54000002,
|
||||
0x54fff482, 0x540052c2, 0x54000003, 0x54fff423,
|
||||
0x54005263, 0x54000003, 0x54fff3c3, 0x54005203,
|
||||
0x54000004, 0x54fff364, 0x540051a4, 0x54000005,
|
||||
0x54fff305, 0x54005145, 0x54000006, 0x54fff2a6,
|
||||
0x540050e6, 0x54000007, 0x54fff247, 0x54005087,
|
||||
0x54000008, 0x54fff1e8, 0x54005028, 0x54000009,
|
||||
0x54fff189, 0x54004fc9, 0x5400000a, 0x54fff12a,
|
||||
0x54004f6a, 0x5400000b, 0x54fff0cb, 0x54004f0b,
|
||||
0x5400000c, 0x54fff06c, 0x54004eac, 0x5400000d,
|
||||
0x54fff00d, 0x54004e4d, 0x5400000e, 0x54ffefae,
|
||||
0x54004dee, 0x5400000f, 0x54ffef4f, 0x54004d8f,
|
||||
0x54005460, 0x54000001, 0x54fff541, 0x54005401,
|
||||
0x54000002, 0x54fff4e2, 0x540053a2, 0x54000002,
|
||||
0x54fff482, 0x54005342, 0x54000003, 0x54fff423,
|
||||
0x540052e3, 0x54000003, 0x54fff3c3, 0x54005283,
|
||||
0x54000004, 0x54fff364, 0x54005224, 0x54000005,
|
||||
0x54fff305, 0x540051c5, 0x54000006, 0x54fff2a6,
|
||||
0x54005166, 0x54000007, 0x54fff247, 0x54005107,
|
||||
0x54000008, 0x54fff1e8, 0x540050a8, 0x54000009,
|
||||
0x54fff189, 0x54005049, 0x5400000a, 0x54fff12a,
|
||||
0x54004fea, 0x5400000b, 0x54fff0cb, 0x54004f8b,
|
||||
0x5400000c, 0x54fff06c, 0x54004f2c, 0x5400000d,
|
||||
0x54fff00d, 0x54004ecd, 0x5400000e, 0x54ffefae,
|
||||
0x54004e6e, 0x5400000f, 0x54ffef4f, 0x54004e0f,
|
||||
0xd40658e1, 0xd4014d22, 0xd4046543, 0xd4273f60,
|
||||
0xd44cad80, 0xd503201f, 0xd69f03e0, 0xd6bf03e0,
|
||||
0xd5033fdf, 0xd5033e9f, 0xd50332bf, 0xd61f0200,
|
||||
|
@ -1056,7 +1062,7 @@ void entry(CodeBuffer *cb) {
|
|||
0x791f226d, 0xf95aa2f3, 0xb9587bb7, 0x395f7176,
|
||||
0x795d9143, 0x399e7e08, 0x799a2697, 0x79df3422,
|
||||
0xb99c2624, 0xfd5c2374, 0xbd5fa1d9, 0xfd1d595a,
|
||||
0xbd1b1869, 0x58003ddb, 0x1800000b, 0xf8945060,
|
||||
0xbd1b1869, 0x58003e5b, 0x1800000b, 0xf8945060,
|
||||
0xd8000000, 0xf8ae6ba0, 0xf99a0080, 0x1a070035,
|
||||
0x3a0700a8, 0x5a0e0367, 0x7a11009b, 0x9a000380,
|
||||
0xba1e030c, 0xda0f0320, 0xfa030301, 0x0b340b11,
|
||||
|
@ -1129,7 +1135,6 @@ void entry(CodeBuffer *cb) {
|
|||
0x6eaae528, 0x6ee0e7fe, 0x0e333e51, 0x4e2c3d6a,
|
||||
0x0e7d3f9b, 0x4e643c62, 0x0eba3f38, 0x4ea63ca4,
|
||||
0x4ee53c83, 0x2e2ae528, 0x6e38e6f6, 0x6e73e651,
|
||||
0xce7c808d, 0xce7986b7, 0xcec08078, 0xce778b57,
|
||||
0xba5fd3e3, 0x3a5f03e5, 0xfa411be4, 0x7a42cbe2,
|
||||
0x93df03ff, 0xc820ffff, 0x8822fc7f, 0xc8247cbf,
|
||||
0x88267fff, 0x4e010fe0, 0x4e081fe1, 0x4e0c1fe1,
|
||||
|
@ -1150,36 +1155,38 @@ void entry(CodeBuffer *cb) {
|
|||
0x1e741000, 0x1e743000, 0x1e761000, 0x1e763000,
|
||||
0x1e781000, 0x1e783000, 0x1e7a1000, 0x1e7a3000,
|
||||
0x1e7c1000, 0x1e7c3000, 0x1e7e1000, 0x1e7e3000,
|
||||
0xf82f8075, 0xf8380328, 0xf8341230, 0xf8222001,
|
||||
0xf8383064, 0xf82c539f, 0xf82a405a, 0xf82c73f0,
|
||||
0xf82163ad, 0xf8a08193, 0xf8b101b6, 0xf8bc13fe,
|
||||
0xf8a1239a, 0xf8a4309e, 0xf8a6535e, 0xf8b04109,
|
||||
0xf8ac7280, 0xf8a16058, 0xf8e08309, 0xf8fa03d0,
|
||||
0xf8e312ea, 0xf8ea21e4, 0xf8e2310b, 0xf8ea522f,
|
||||
0xf8e2418a, 0xf8ec71af, 0xf8e26287, 0xf87a8090,
|
||||
0xf8620184, 0xf8701215, 0xf87022ab, 0xf877334c,
|
||||
0xf87751dc, 0xf86b4038, 0xf86c715f, 0xf8706047,
|
||||
0xb823826d, 0xb8310070, 0xb82113cb, 0xb82521e8,
|
||||
0xb83d301e, 0xb8345287, 0xb83742bc, 0xb83b70b9,
|
||||
0xb8216217, 0xb8bf8185, 0xb8a901fc, 0xb8bd13f6,
|
||||
0xb8b320bf, 0xb8ae33f0, 0xb8b0529b, 0xb8b0416c,
|
||||
0xb8a973c6, 0xb8b1639b, 0xb8fe8147, 0xb8f4008a,
|
||||
0xb8f81231, 0xb8f623a3, 0xb8ef3276, 0xb8f35056,
|
||||
0xb8ef4186, 0xb8f071ab, 0xb8f763c1, 0xb8738225,
|
||||
0xb86202d0, 0xb86d12aa, 0xb87d219b, 0xb87b3023,
|
||||
0xb87f5278, 0xb8714389, 0xb87b70ef, 0xb87563f7,
|
||||
0x04fe0058, 0x04b60551, 0x65c00222, 0x65c20ad9,
|
||||
0x65db046c, 0x0416b35c, 0x04001e29, 0x045085e4,
|
||||
0x04daa856, 0x04d39cb4, 0x041191c0, 0x04900b79,
|
||||
0x0497bb1a, 0x049ea4c0, 0x040805e0, 0x044a04a9,
|
||||
0x0481069b, 0x049ca554, 0x65c09cd0, 0x65cd8fa2,
|
||||
0x65c69ac2, 0x65c78f6e, 0x65828457, 0x04ddb14a,
|
||||
0x65c2ac76, 0x65c0a430, 0x6581b190, 0x658da20c,
|
||||
0x658194b4, 0x65fb1187, 0x65bc2450, 0x65b34624,
|
||||
0x65f8750c, 0x04174151, 0x04107db3, 0x042e30e0,
|
||||
0x04aa3119, 0x047b32d4, 0x049a2e23, 0x04182787,
|
||||
0x04992a00, 0x044825f6, 0x040a2b36, 0x65c731be,
|
||||
0x658621ab, 0x65983334, 0x04412624,
|
||||
0xf82d83a5, 0xf8380355, 0xf8381303, 0xf83a21f7,
|
||||
0xf8353303, 0xf8285299, 0xf8304051, 0xf8217300,
|
||||
0xf8246183, 0xf8bf815c, 0xf8ba0182, 0xf8b0103f,
|
||||
0xf8ad201d, 0xf8b3322c, 0xf8b6538d, 0xf8be403f,
|
||||
0xf8ba709c, 0xf8be60c4, 0xf8fe81fa, 0xf8e90188,
|
||||
0xf8e01034, 0xf8f82002, 0xf8e93358, 0xf8f0507e,
|
||||
0xf8ea4157, 0xf8e47050, 0xf8eb6148, 0xf86f8051,
|
||||
0xf86a018c, 0xf86f104d, 0xf8672354, 0xf8703044,
|
||||
0xf86451ec, 0xf87541f0, 0xf86b72f5, 0xf86c62fa,
|
||||
0xb83c816e, 0xb8380181, 0xb83f120a, 0xb8272062,
|
||||
0xb82d3233, 0xb8305023, 0xb82b40be, 0xb82873af,
|
||||
0xb83e6280, 0xb8a782f4, 0xb8bc0375, 0xb8b91025,
|
||||
0xb8b723f0, 0xb8a5312c, 0xb8bc53af, 0xb8b6427f,
|
||||
0xb8bf71c5, 0xb8b061ff, 0xb8fb8214, 0xb8ec012b,
|
||||
0xb8e6123e, 0xb8fb23dc, 0xb8e7328a, 0xb8ea5304,
|
||||
0xb8f142d1, 0xb8e371fd, 0xb8f66273, 0xb87681e2,
|
||||
0xb866020c, 0xb86b12ed, 0xb861227e, 0xb8653051,
|
||||
0xb87051b6, 0xb86a43b5, 0xb87b736c, 0xb86363e1,
|
||||
0xce312677, 0xce0e1b5b, 0xce7e8ed4, 0xce9ed858,
|
||||
0xce768151, 0xce718451, 0xcec08300, 0xce628ad9,
|
||||
0x04e30191, 0x04f0079d, 0x65dc0126, 0x65870887,
|
||||
0x658806c9, 0x0416b7db, 0x0440021a, 0x04d09903,
|
||||
0x04dabb55, 0x04138096, 0x04518071, 0x041008c1,
|
||||
0x0497bce9, 0x045eb4b6, 0x040813c8, 0x04ca0171,
|
||||
0x0481035c, 0x04dcadbc, 0x658098b0, 0x658d89ed,
|
||||
0x6586957a, 0x65879096, 0x65829233, 0x04ddac4e,
|
||||
0x6582b6e3, 0x6580a626, 0x6581b21b, 0x658dbc62,
|
||||
0x65819266, 0x65f8150c, 0x65b72151, 0x65b05db3,
|
||||
0x65f165c0, 0x04944ac8, 0x048f607b, 0x042430f4,
|
||||
0x04a83007, 0x046432d3, 0x04da3569, 0x04583e05,
|
||||
0x04592c36, 0x04c83608, 0x048a248f, 0x658727a8,
|
||||
0x65c633bc, 0x65982c49, 0x040120fc,
|
||||
};
|
||||
// END Generated code -- do not edit
|
||||
|
||||
|
|
|
@ -2550,6 +2550,40 @@ public:
|
|||
|
||||
#undef INSN
|
||||
|
||||
#define INSN(NAME, opc) \
|
||||
void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, FloatRegister Vm, FloatRegister Va) { \
|
||||
starti; \
|
||||
assert(T == T16B, "arrangement must be T16B"); \
|
||||
f(0b11001110, 31, 24), f(opc, 23, 21), rf(Vm, 16), f(0b0, 15, 15), rf(Va, 10), rf(Vn, 5), rf(Vd, 0); \
|
||||
}
|
||||
|
||||
INSN(eor3, 0b000);
|
||||
INSN(bcax, 0b001);
|
||||
|
||||
#undef INSN
|
||||
|
||||
#define INSN(NAME, opc) \
|
||||
void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, FloatRegister Vm, unsigned imm) { \
|
||||
starti; \
|
||||
assert(T == T2D, "arrangement must be T2D"); \
|
||||
f(0b11001110, 31, 24), f(opc, 23, 21), rf(Vm, 16), f(imm, 15, 10), rf(Vn, 5), rf(Vd, 0); \
|
||||
}
|
||||
|
||||
INSN(xar, 0b100);
|
||||
|
||||
#undef INSN
|
||||
|
||||
#define INSN(NAME, opc) \
|
||||
void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, FloatRegister Vm) { \
|
||||
starti; \
|
||||
assert(T == T2D, "arrangement must be T2D"); \
|
||||
f(0b11001110, 31, 24), f(opc, 23, 21), rf(Vm, 16), f(0b100011, 15, 10), rf(Vn, 5), rf(Vd, 0); \
|
||||
}
|
||||
|
||||
INSN(rax1, 0b011);
|
||||
|
||||
#undef INSN
|
||||
|
||||
#define INSN(NAME, opc) \
|
||||
void NAME(FloatRegister Vd, FloatRegister Vn) { \
|
||||
starti; \
|
||||
|
|
|
@ -3309,6 +3309,225 @@ class StubGenerator: public StubCodeGenerator {
|
|||
return start;
|
||||
}
|
||||
|
||||
// Arguments:
|
||||
//
|
||||
// Inputs:
|
||||
// c_rarg0 - byte[] source+offset
|
||||
// c_rarg1 - byte[] SHA.state
|
||||
// c_rarg2 - int digest_length
|
||||
// c_rarg3 - int offset
|
||||
// c_rarg4 - int limit
|
||||
//
|
||||
address generate_sha3_implCompress(bool multi_block, const char *name) {
|
||||
static const uint64_t round_consts[24] = {
|
||||
0x0000000000000001L, 0x0000000000008082L, 0x800000000000808AL,
|
||||
0x8000000080008000L, 0x000000000000808BL, 0x0000000080000001L,
|
||||
0x8000000080008081L, 0x8000000000008009L, 0x000000000000008AL,
|
||||
0x0000000000000088L, 0x0000000080008009L, 0x000000008000000AL,
|
||||
0x000000008000808BL, 0x800000000000008BL, 0x8000000000008089L,
|
||||
0x8000000000008003L, 0x8000000000008002L, 0x8000000000000080L,
|
||||
0x000000000000800AL, 0x800000008000000AL, 0x8000000080008081L,
|
||||
0x8000000000008080L, 0x0000000080000001L, 0x8000000080008008L
|
||||
};
|
||||
|
||||
__ align(CodeEntryAlignment);
|
||||
StubCodeMark mark(this, "StubRoutines", name);
|
||||
address start = __ pc();
|
||||
|
||||
Register buf = c_rarg0;
|
||||
Register state = c_rarg1;
|
||||
Register digest_length = c_rarg2;
|
||||
Register ofs = c_rarg3;
|
||||
Register limit = c_rarg4;
|
||||
|
||||
Label sha3_loop, rounds24_loop;
|
||||
Label sha3_512, sha3_384_or_224, sha3_256;
|
||||
|
||||
__ stpd(v8, v9, __ pre(sp, -64));
|
||||
__ stpd(v10, v11, Address(sp, 16));
|
||||
__ stpd(v12, v13, Address(sp, 32));
|
||||
__ stpd(v14, v15, Address(sp, 48));
|
||||
|
||||
// load state
|
||||
__ add(rscratch1, state, 32);
|
||||
__ ld1(v0, v1, v2, v3, __ T1D, state);
|
||||
__ ld1(v4, v5, v6, v7, __ T1D, __ post(rscratch1, 32));
|
||||
__ ld1(v8, v9, v10, v11, __ T1D, __ post(rscratch1, 32));
|
||||
__ ld1(v12, v13, v14, v15, __ T1D, __ post(rscratch1, 32));
|
||||
__ ld1(v16, v17, v18, v19, __ T1D, __ post(rscratch1, 32));
|
||||
__ ld1(v20, v21, v22, v23, __ T1D, __ post(rscratch1, 32));
|
||||
__ ld1(v24, __ T1D, rscratch1);
|
||||
|
||||
__ BIND(sha3_loop);
|
||||
|
||||
// 24 keccak rounds
|
||||
__ movw(rscratch2, 24);
|
||||
|
||||
// load round_constants base
|
||||
__ lea(rscratch1, ExternalAddress((address) round_consts));
|
||||
|
||||
// load input
|
||||
__ ld1(v25, v26, v27, v28, __ T8B, __ post(buf, 32));
|
||||
__ ld1(v29, v30, v31, __ T8B, __ post(buf, 24));
|
||||
__ eor(v0, __ T8B, v0, v25);
|
||||
__ eor(v1, __ T8B, v1, v26);
|
||||
__ eor(v2, __ T8B, v2, v27);
|
||||
__ eor(v3, __ T8B, v3, v28);
|
||||
__ eor(v4, __ T8B, v4, v29);
|
||||
__ eor(v5, __ T8B, v5, v30);
|
||||
__ eor(v6, __ T8B, v6, v31);
|
||||
|
||||
// digest_length == 64, SHA3-512
|
||||
__ tbnz(digest_length, 6, sha3_512);
|
||||
|
||||
__ ld1(v25, v26, v27, v28, __ T8B, __ post(buf, 32));
|
||||
__ ld1(v29, v30, __ T8B, __ post(buf, 16));
|
||||
__ eor(v7, __ T8B, v7, v25);
|
||||
__ eor(v8, __ T8B, v8, v26);
|
||||
__ eor(v9, __ T8B, v9, v27);
|
||||
__ eor(v10, __ T8B, v10, v28);
|
||||
__ eor(v11, __ T8B, v11, v29);
|
||||
__ eor(v12, __ T8B, v12, v30);
|
||||
|
||||
// digest_length == 28, SHA3-224; digest_length == 48, SHA3-384
|
||||
__ tbnz(digest_length, 4, sha3_384_or_224);
|
||||
|
||||
// SHA3-256
|
||||
__ ld1(v25, v26, v27, v28, __ T8B, __ post(buf, 32));
|
||||
__ eor(v13, __ T8B, v13, v25);
|
||||
__ eor(v14, __ T8B, v14, v26);
|
||||
__ eor(v15, __ T8B, v15, v27);
|
||||
__ eor(v16, __ T8B, v16, v28);
|
||||
__ b(rounds24_loop);
|
||||
|
||||
__ BIND(sha3_384_or_224);
|
||||
__ tbz(digest_length, 2, rounds24_loop); // bit 2 cleared? SHA-384
|
||||
|
||||
// SHA3-224
|
||||
__ ld1(v25, v26, v27, v28, __ T8B, __ post(buf, 32));
|
||||
__ ld1(v29, __ T8B, __ post(buf, 8));
|
||||
__ eor(v13, __ T8B, v13, v25);
|
||||
__ eor(v14, __ T8B, v14, v26);
|
||||
__ eor(v15, __ T8B, v15, v27);
|
||||
__ eor(v16, __ T8B, v16, v28);
|
||||
__ eor(v17, __ T8B, v17, v29);
|
||||
__ b(rounds24_loop);
|
||||
|
||||
__ BIND(sha3_512);
|
||||
__ ld1(v25, v26, __ T8B, __ post(buf, 16));
|
||||
__ eor(v7, __ T8B, v7, v25);
|
||||
__ eor(v8, __ T8B, v8, v26);
|
||||
|
||||
__ BIND(rounds24_loop);
|
||||
__ subw(rscratch2, rscratch2, 1);
|
||||
|
||||
__ eor3(v29, __ T16B, v4, v9, v14);
|
||||
__ eor3(v26, __ T16B, v1, v6, v11);
|
||||
__ eor3(v28, __ T16B, v3, v8, v13);
|
||||
__ eor3(v25, __ T16B, v0, v5, v10);
|
||||
__ eor3(v27, __ T16B, v2, v7, v12);
|
||||
__ eor3(v29, __ T16B, v29, v19, v24);
|
||||
__ eor3(v26, __ T16B, v26, v16, v21);
|
||||
__ eor3(v28, __ T16B, v28, v18, v23);
|
||||
__ eor3(v25, __ T16B, v25, v15, v20);
|
||||
__ eor3(v27, __ T16B, v27, v17, v22);
|
||||
|
||||
__ rax1(v30, __ T2D, v29, v26);
|
||||
__ rax1(v26, __ T2D, v26, v28);
|
||||
__ rax1(v28, __ T2D, v28, v25);
|
||||
__ rax1(v25, __ T2D, v25, v27);
|
||||
__ rax1(v27, __ T2D, v27, v29);
|
||||
|
||||
__ eor(v0, __ T16B, v0, v30);
|
||||
__ xar(v29, __ T2D, v1, v25, (64 - 1));
|
||||
__ xar(v1, __ T2D, v6, v25, (64 - 44));
|
||||
__ xar(v6, __ T2D, v9, v28, (64 - 20));
|
||||
__ xar(v9, __ T2D, v22, v26, (64 - 61));
|
||||
__ xar(v22, __ T2D, v14, v28, (64 - 39));
|
||||
__ xar(v14, __ T2D, v20, v30, (64 - 18));
|
||||
__ xar(v31, __ T2D, v2, v26, (64 - 62));
|
||||
__ xar(v2, __ T2D, v12, v26, (64 - 43));
|
||||
__ xar(v12, __ T2D, v13, v27, (64 - 25));
|
||||
__ xar(v13, __ T2D, v19, v28, (64 - 8));
|
||||
__ xar(v19, __ T2D, v23, v27, (64 - 56));
|
||||
__ xar(v23, __ T2D, v15, v30, (64 - 41));
|
||||
__ xar(v15, __ T2D, v4, v28, (64 - 27));
|
||||
__ xar(v28, __ T2D, v24, v28, (64 - 14));
|
||||
__ xar(v24, __ T2D, v21, v25, (64 - 2));
|
||||
__ xar(v8, __ T2D, v8, v27, (64 - 55));
|
||||
__ xar(v4, __ T2D, v16, v25, (64 - 45));
|
||||
__ xar(v16, __ T2D, v5, v30, (64 - 36));
|
||||
__ xar(v5, __ T2D, v3, v27, (64 - 28));
|
||||
__ xar(v27, __ T2D, v18, v27, (64 - 21));
|
||||
__ xar(v3, __ T2D, v17, v26, (64 - 15));
|
||||
__ xar(v25, __ T2D, v11, v25, (64 - 10));
|
||||
__ xar(v26, __ T2D, v7, v26, (64 - 6));
|
||||
__ xar(v30, __ T2D, v10, v30, (64 - 3));
|
||||
|
||||
__ bcax(v20, __ T16B, v31, v22, v8);
|
||||
__ bcax(v21, __ T16B, v8, v23, v22);
|
||||
__ bcax(v22, __ T16B, v22, v24, v23);
|
||||
__ bcax(v23, __ T16B, v23, v31, v24);
|
||||
__ bcax(v24, __ T16B, v24, v8, v31);
|
||||
|
||||
__ ld1r(v31, __ T2D, __ post(rscratch1, 8));
|
||||
|
||||
__ bcax(v17, __ T16B, v25, v19, v3);
|
||||
__ bcax(v18, __ T16B, v3, v15, v19);
|
||||
__ bcax(v19, __ T16B, v19, v16, v15);
|
||||
__ bcax(v15, __ T16B, v15, v25, v16);
|
||||
__ bcax(v16, __ T16B, v16, v3, v25);
|
||||
|
||||
__ bcax(v10, __ T16B, v29, v12, v26);
|
||||
__ bcax(v11, __ T16B, v26, v13, v12);
|
||||
__ bcax(v12, __ T16B, v12, v14, v13);
|
||||
__ bcax(v13, __ T16B, v13, v29, v14);
|
||||
__ bcax(v14, __ T16B, v14, v26, v29);
|
||||
|
||||
__ bcax(v7, __ T16B, v30, v9, v4);
|
||||
__ bcax(v8, __ T16B, v4, v5, v9);
|
||||
__ bcax(v9, __ T16B, v9, v6, v5);
|
||||
__ bcax(v5, __ T16B, v5, v30, v6);
|
||||
__ bcax(v6, __ T16B, v6, v4, v30);
|
||||
|
||||
__ bcax(v3, __ T16B, v27, v0, v28);
|
||||
__ bcax(v4, __ T16B, v28, v1, v0);
|
||||
__ bcax(v0, __ T16B, v0, v2, v1);
|
||||
__ bcax(v1, __ T16B, v1, v27, v2);
|
||||
__ bcax(v2, __ T16B, v2, v28, v27);
|
||||
|
||||
__ eor(v0, __ T16B, v0, v31);
|
||||
|
||||
__ cbnzw(rscratch2, rounds24_loop);
|
||||
|
||||
if (multi_block) {
|
||||
// block_size = 200 - 2 * digest_length, ofs += block_size
|
||||
__ add(ofs, ofs, 200);
|
||||
__ sub(ofs, ofs, digest_length, Assembler::LSL, 1);
|
||||
|
||||
__ cmp(ofs, limit);
|
||||
__ br(Assembler::LE, sha3_loop);
|
||||
__ mov(c_rarg0, ofs); // return ofs
|
||||
}
|
||||
|
||||
__ st1(v0, v1, v2, v3, __ T1D, __ post(state, 32));
|
||||
__ st1(v4, v5, v6, v7, __ T1D, __ post(state, 32));
|
||||
__ st1(v8, v9, v10, v11, __ T1D, __ post(state, 32));
|
||||
__ st1(v12, v13, v14, v15, __ T1D, __ post(state, 32));
|
||||
__ st1(v16, v17, v18, v19, __ T1D, __ post(state, 32));
|
||||
__ st1(v20, v21, v22, v23, __ T1D, __ post(state, 32));
|
||||
__ st1(v24, __ T1D, state);
|
||||
|
||||
__ ldpd(v14, v15, Address(sp, 48));
|
||||
__ ldpd(v12, v13, Address(sp, 32));
|
||||
__ ldpd(v10, v11, Address(sp, 16));
|
||||
__ ldpd(v8, v9, __ post(sp, 64));
|
||||
|
||||
__ ret(lr);
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
// Safefetch stubs.
|
||||
void generate_safefetch(const char* name, int size, address* entry,
|
||||
address* fault_pc, address* continuation_pc) {
|
||||
|
@ -6048,6 +6267,10 @@ class StubGenerator: public StubCodeGenerator {
|
|||
StubRoutines::_sha512_implCompress = generate_sha512_implCompress(false, "sha512_implCompress");
|
||||
StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(true, "sha512_implCompressMB");
|
||||
}
|
||||
if (UseSHA3Intrinsics) {
|
||||
StubRoutines::_sha3_implCompress = generate_sha3_implCompress(false, "sha3_implCompress");
|
||||
StubRoutines::_sha3_implCompressMB = generate_sha3_implCompress(true, "sha3_implCompressMB");
|
||||
}
|
||||
|
||||
// generate Adler32 intrinsics code
|
||||
if (UseAdler32Intrinsics) {
|
||||
|
|
|
@ -194,6 +194,7 @@ void VM_Version::initialize() {
|
|||
if (_features & CPU_AES) strcat(buf, ", aes");
|
||||
if (_features & CPU_SHA1) strcat(buf, ", sha1");
|
||||
if (_features & CPU_SHA2) strcat(buf, ", sha256");
|
||||
if (_features & CPU_SHA3) strcat(buf, ", sha3");
|
||||
if (_features & CPU_SHA512) strcat(buf, ", sha512");
|
||||
if (_features & CPU_LSE) strcat(buf, ", lse");
|
||||
if (_features & CPU_SVE) strcat(buf, ", sve");
|
||||
|
@ -275,7 +276,7 @@ void VM_Version::initialize() {
|
|||
FLAG_SET_DEFAULT(UseMD5Intrinsics, false);
|
||||
}
|
||||
|
||||
if (_features & (CPU_SHA1 | CPU_SHA2)) {
|
||||
if (_features & (CPU_SHA1 | CPU_SHA2 | CPU_SHA3 | CPU_SHA512)) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA)) {
|
||||
FLAG_SET_DEFAULT(UseSHA, true);
|
||||
}
|
||||
|
@ -302,6 +303,16 @@ void VM_Version::initialize() {
|
|||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA && (_features & CPU_SHA3)) {
|
||||
// Do not auto-enable UseSHA3Intrinsics until it has been fully tested on hardware
|
||||
// if (FLAG_IS_DEFAULT(UseSHA3Intrinsics)) {
|
||||
// FLAG_SET_DEFAULT(UseSHA3Intrinsics, true);
|
||||
// }
|
||||
} else if (UseSHA3Intrinsics) {
|
||||
warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA3Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA && (_features & CPU_SHA512)) {
|
||||
// Do not auto-enable UseSHA512Intrinsics until it has been fully tested on hardware
|
||||
// if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
|
||||
|
@ -312,7 +323,7 @@ void VM_Version::initialize() {
|
|||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
}
|
||||
|
||||
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA3Intrinsics || UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ public:
|
|||
CPU_CRC32 = (1<<7),
|
||||
CPU_LSE = (1<<8),
|
||||
CPU_DCPOP = (1<<16),
|
||||
CPU_SHA3 = (1<<17),
|
||||
CPU_SHA512 = (1<<21),
|
||||
CPU_SVE = (1<<22),
|
||||
// flags above must follow Linux HWCAP
|
||||
|
|
|
@ -236,6 +236,11 @@ void VM_Version::initialize() {
|
|||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA3Intrinsics) {
|
||||
warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA3Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseCRC32Intrinsics) {
|
||||
if (!FLAG_IS_DEFAULT(UseCRC32Intrinsics))
|
||||
warning("CRC32 intrinsics are not available on this CPU");
|
||||
|
|
|
@ -331,6 +331,11 @@ void VM_Version::initialize() {
|
|||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA3Intrinsics) {
|
||||
warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA3Intrinsics, false);
|
||||
}
|
||||
|
||||
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
|
|
|
@ -221,6 +221,11 @@ void VM_Version::initialize() {
|
|||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA3Intrinsics) {
|
||||
warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA3Intrinsics, false);
|
||||
}
|
||||
|
||||
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
|
|
|
@ -981,6 +981,11 @@ void VM_Version::get_processor_features() {
|
|||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA3Intrinsics) {
|
||||
warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA3Intrinsics, false);
|
||||
}
|
||||
|
||||
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
|
|
|
@ -59,6 +59,10 @@
|
|||
#define HWCAP_DCPOP (1<<16)
|
||||
#endif
|
||||
|
||||
#ifndef HWCAP_SHA3
|
||||
#define HWCAP_SHA3 (1 << 17)
|
||||
#endif
|
||||
|
||||
#ifndef HWCAP_SHA512
|
||||
#define HWCAP_SHA512 (1 << 21)
|
||||
#endif
|
||||
|
@ -103,6 +107,7 @@ void VM_Version::get_os_cpu_info() {
|
|||
static_assert(CPU_CRC32 == HWCAP_CRC32);
|
||||
static_assert(CPU_LSE == HWCAP_ATOMICS);
|
||||
static_assert(CPU_DCPOP == HWCAP_DCPOP);
|
||||
static_assert(CPU_SHA3 == HWCAP_SHA3);
|
||||
static_assert(CPU_SHA512 == HWCAP_SHA512);
|
||||
static_assert(CPU_SVE == HWCAP_SVE);
|
||||
_features = auxv & (
|
||||
|
@ -116,6 +121,7 @@ void VM_Version::get_os_cpu_info() {
|
|||
HWCAP_CRC32 |
|
||||
HWCAP_ATOMICS |
|
||||
HWCAP_DCPOP |
|
||||
HWCAP_SHA3 |
|
||||
HWCAP_SHA512 |
|
||||
HWCAP_SVE);
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ int vmIntrinsics::predicates_needed(vmIntrinsics::ID id) {
|
|||
case vmIntrinsics::_counterMode_AESCrypt:
|
||||
return 1;
|
||||
case vmIntrinsics::_digestBase_implCompressMB:
|
||||
return 4;
|
||||
return 5;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -436,8 +436,11 @@ bool vmIntrinsics::disabled_by_jvm_flags(vmIntrinsics::ID id) {
|
|||
case vmIntrinsics::_sha5_implCompress:
|
||||
if (!UseSHA512Intrinsics) return true;
|
||||
break;
|
||||
case vmIntrinsics::_sha3_implCompress:
|
||||
if (!UseSHA3Intrinsics) return true;
|
||||
break;
|
||||
case vmIntrinsics::_digestBase_implCompressMB:
|
||||
if (!(UseMD5Intrinsics || UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) return true;
|
||||
if (!(UseMD5Intrinsics || UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics || UseSHA3Intrinsics)) return true;
|
||||
break;
|
||||
case vmIntrinsics::_ghash_processBlocks:
|
||||
if (!UseGHASHIntrinsics) return true;
|
||||
|
|
|
@ -432,6 +432,10 @@ class methodHandle;
|
|||
do_class(sun_security_provider_sha5, "sun/security/provider/SHA5") \
|
||||
do_intrinsic(_sha5_implCompress, sun_security_provider_sha5, implCompress_name, implCompress_signature, F_R) \
|
||||
\
|
||||
/* support for sun.security.provider.SHA3 */ \
|
||||
do_class(sun_security_provider_sha3, "sun/security/provider/SHA3") \
|
||||
do_intrinsic(_sha3_implCompress, sun_security_provider_sha3, implCompress_name, implCompress_signature, F_R) \
|
||||
\
|
||||
/* support for sun.security.provider.DigestBase */ \
|
||||
do_class(sun_security_provider_digestbase, "sun/security/provider/DigestBase") \
|
||||
do_intrinsic(_digestBase_implCompressMB, sun_security_provider_digestbase, implCompressMB_name, implCompressMB_signature, F_R) \
|
||||
|
|
|
@ -626,6 +626,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
|
|||
case vmIntrinsics::_sha_implCompress:
|
||||
case vmIntrinsics::_sha2_implCompress:
|
||||
case vmIntrinsics::_sha5_implCompress:
|
||||
case vmIntrinsics::_sha3_implCompress:
|
||||
case vmIntrinsics::_digestBase_implCompressMB:
|
||||
case vmIntrinsics::_multiplyToLen:
|
||||
case vmIntrinsics::_squareToLen:
|
||||
|
|
|
@ -1085,6 +1085,8 @@ void ConnectionGraph::process_call_arguments(CallNode *call) {
|
|||
strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "sha3_implCompress") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "sha3_implCompressMB") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 ||
|
||||
|
|
|
@ -542,6 +542,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
|
|||
case vmIntrinsics::_sha_implCompress:
|
||||
case vmIntrinsics::_sha2_implCompress:
|
||||
case vmIntrinsics::_sha5_implCompress:
|
||||
case vmIntrinsics::_sha3_implCompress:
|
||||
return inline_digestBase_implCompress(intrinsic_id());
|
||||
|
||||
case vmIntrinsics::_digestBase_implCompressMB:
|
||||
|
@ -6188,6 +6189,9 @@ bool LibraryCallKit::inline_base64_encodeBlock() {
|
|||
// Calculate SHA5 (i.e., SHA-384 or SHA-512) for single-block byte[] array.
|
||||
// void com.sun.security.provider.SHA5.implCompress(byte[] buf, int ofs)
|
||||
//
|
||||
// Calculate SHA3 (i.e., SHA3-224 or SHA3-256 or SHA3-384 or SHA3-512) for single-block byte[] array.
|
||||
// void com.sun.security.provider.SHA3.implCompress(byte[] buf, int ofs)
|
||||
//
|
||||
bool LibraryCallKit::inline_digestBase_implCompress(vmIntrinsics::ID id) {
|
||||
assert(callee()->signature()->size() == 2, "sha_implCompress has 2 parameters");
|
||||
|
||||
|
@ -6210,34 +6214,43 @@ bool LibraryCallKit::inline_digestBase_implCompress(vmIntrinsics::ID id) {
|
|||
src = must_be_not_null(src, true);
|
||||
Node* src_start = array_element_address(src, ofs, src_elem);
|
||||
Node* state = NULL;
|
||||
Node* digest_length = NULL;
|
||||
address stubAddr;
|
||||
const char *stubName;
|
||||
|
||||
switch(id) {
|
||||
case vmIntrinsics::_md5_implCompress:
|
||||
assert(UseMD5Intrinsics, "need MD5 instruction support");
|
||||
state = get_state_from_digest_object(digestBase_obj);
|
||||
state = get_state_from_digest_object(digestBase_obj, "[I");
|
||||
stubAddr = StubRoutines::md5_implCompress();
|
||||
stubName = "md5_implCompress";
|
||||
break;
|
||||
case vmIntrinsics::_sha_implCompress:
|
||||
assert(UseSHA1Intrinsics, "need SHA1 instruction support");
|
||||
state = get_state_from_digest_object(digestBase_obj);
|
||||
state = get_state_from_digest_object(digestBase_obj, "[I");
|
||||
stubAddr = StubRoutines::sha1_implCompress();
|
||||
stubName = "sha1_implCompress";
|
||||
break;
|
||||
case vmIntrinsics::_sha2_implCompress:
|
||||
assert(UseSHA256Intrinsics, "need SHA256 instruction support");
|
||||
state = get_state_from_digest_object(digestBase_obj);
|
||||
state = get_state_from_digest_object(digestBase_obj, "[I");
|
||||
stubAddr = StubRoutines::sha256_implCompress();
|
||||
stubName = "sha256_implCompress";
|
||||
break;
|
||||
case vmIntrinsics::_sha5_implCompress:
|
||||
assert(UseSHA512Intrinsics, "need SHA512 instruction support");
|
||||
state = get_long_state_from_digest_object(digestBase_obj);
|
||||
state = get_state_from_digest_object(digestBase_obj, "[J");
|
||||
stubAddr = StubRoutines::sha512_implCompress();
|
||||
stubName = "sha512_implCompress";
|
||||
break;
|
||||
case vmIntrinsics::_sha3_implCompress:
|
||||
assert(UseSHA3Intrinsics, "need SHA3 instruction support");
|
||||
state = get_state_from_digest_object(digestBase_obj, "[B");
|
||||
stubAddr = StubRoutines::sha3_implCompress();
|
||||
stubName = "sha3_implCompress";
|
||||
digest_length = get_digest_length_from_digest_object(digestBase_obj);
|
||||
if (digest_length == NULL) return false;
|
||||
break;
|
||||
default:
|
||||
fatal_unexpected_iid(id);
|
||||
return false;
|
||||
|
@ -6248,22 +6261,29 @@ bool LibraryCallKit::inline_digestBase_implCompress(vmIntrinsics::ID id) {
|
|||
if (stubAddr == NULL) return false;
|
||||
|
||||
// Call the stub.
|
||||
Node* call = make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::digestBase_implCompress_Type(),
|
||||
stubAddr, stubName, TypePtr::BOTTOM,
|
||||
src_start, state);
|
||||
Node* call;
|
||||
if (digest_length == NULL) {
|
||||
call = make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::digestBase_implCompress_Type(false),
|
||||
stubAddr, stubName, TypePtr::BOTTOM,
|
||||
src_start, state);
|
||||
} else {
|
||||
call = make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::digestBase_implCompress_Type(true),
|
||||
stubAddr, stubName, TypePtr::BOTTOM,
|
||||
src_start, state, digest_length);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------inline_digestBase_implCompressMB-----------------------
|
||||
//
|
||||
// Calculate MD5/SHA/SHA2/SHA5 for multi-block byte[] array.
|
||||
// Calculate MD5/SHA/SHA2/SHA5/SHA3 for multi-block byte[] array.
|
||||
// int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit)
|
||||
//
|
||||
bool LibraryCallKit::inline_digestBase_implCompressMB(int predicate) {
|
||||
assert(UseMD5Intrinsics || UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics,
|
||||
"need MD5/SHA1/SHA256/SHA512 instruction support");
|
||||
assert((uint)predicate < 4, "sanity");
|
||||
assert(UseMD5Intrinsics || UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics || UseSHA3Intrinsics,
|
||||
"need MD5/SHA1/SHA256/SHA512/SHA3 instruction support");
|
||||
assert((uint)predicate < 5, "sanity");
|
||||
assert(callee()->signature()->size() == 3, "digestBase_implCompressMB has 3 parameters");
|
||||
|
||||
Node* digestBase_obj = argument(0); // The receiver was checked for NULL already.
|
||||
|
@ -6289,7 +6309,7 @@ bool LibraryCallKit::inline_digestBase_implCompressMB(int predicate) {
|
|||
const char* klass_digestBase_name = NULL;
|
||||
const char* stub_name = NULL;
|
||||
address stub_addr = NULL;
|
||||
bool long_state = false;
|
||||
const char* state_type = "[I";
|
||||
|
||||
switch (predicate) {
|
||||
case 0:
|
||||
|
@ -6318,7 +6338,15 @@ bool LibraryCallKit::inline_digestBase_implCompressMB(int predicate) {
|
|||
klass_digestBase_name = "sun/security/provider/SHA5";
|
||||
stub_name = "sha512_implCompressMB";
|
||||
stub_addr = StubRoutines::sha512_implCompressMB();
|
||||
long_state = true;
|
||||
state_type = "[J";
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_sha3_implCompress)) {
|
||||
klass_digestBase_name = "sun/security/provider/SHA3";
|
||||
stub_name = "sha3_implCompressMB";
|
||||
stub_addr = StubRoutines::sha3_implCompressMB();
|
||||
state_type = "[B";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -6336,33 +6364,43 @@ bool LibraryCallKit::inline_digestBase_implCompressMB(int predicate) {
|
|||
ciKlass* klass_digestBase = tinst->klass()->as_instance_klass()->find_klass(ciSymbol::make(klass_digestBase_name));
|
||||
assert(klass_digestBase->is_loaded(), "predicate checks that this class is loaded");
|
||||
ciInstanceKlass* instklass_digestBase = klass_digestBase->as_instance_klass();
|
||||
return inline_digestBase_implCompressMB(digestBase_obj, instklass_digestBase, long_state, stub_addr, stub_name, src_start, ofs, limit);
|
||||
return inline_digestBase_implCompressMB(digestBase_obj, instklass_digestBase, state_type, stub_addr, stub_name, src_start, ofs, limit);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------inline_digestBase_implCompressMB-----------------------
|
||||
bool LibraryCallKit::inline_digestBase_implCompressMB(Node* digestBase_obj, ciInstanceKlass* instklass_digestBase,
|
||||
bool long_state, address stubAddr, const char *stubName,
|
||||
const char* state_type, address stubAddr, const char *stubName,
|
||||
Node* src_start, Node* ofs, Node* limit) {
|
||||
const TypeKlassPtr* aklass = TypeKlassPtr::make(instklass_digestBase);
|
||||
const TypeOopPtr* xtype = aklass->as_instance_type();
|
||||
Node* digest_obj = new CheckCastPPNode(control(), digestBase_obj, xtype);
|
||||
digest_obj = _gvn.transform(digest_obj);
|
||||
|
||||
Node* state;
|
||||
if (long_state) {
|
||||
state = get_long_state_from_digest_object(digest_obj);
|
||||
} else {
|
||||
state = get_state_from_digest_object(digest_obj);
|
||||
}
|
||||
Node* state = get_state_from_digest_object(digest_obj, state_type);
|
||||
if (state == NULL) return false;
|
||||
|
||||
Node* digest_length = NULL;
|
||||
if (strcmp("sha3_implCompressMB", stubName) == 0) {
|
||||
digest_length = get_digest_length_from_digest_object(digest_obj);
|
||||
if (digest_length == NULL) return false;
|
||||
}
|
||||
|
||||
// Call the stub.
|
||||
Node* call = make_runtime_call(RC_LEAF|RC_NO_FP,
|
||||
OptoRuntime::digestBase_implCompressMB_Type(),
|
||||
stubAddr, stubName, TypePtr::BOTTOM,
|
||||
src_start, state, ofs, limit);
|
||||
Node* call;
|
||||
if (digest_length == NULL) {
|
||||
call = make_runtime_call(RC_LEAF|RC_NO_FP,
|
||||
OptoRuntime::digestBase_implCompressMB_Type(false),
|
||||
stubAddr, stubName, TypePtr::BOTTOM,
|
||||
src_start, state, ofs, limit);
|
||||
} else {
|
||||
call = make_runtime_call(RC_LEAF|RC_NO_FP,
|
||||
OptoRuntime::digestBase_implCompressMB_Type(true),
|
||||
stubAddr, stubName, TypePtr::BOTTOM,
|
||||
src_start, state, digest_length, ofs, limit);
|
||||
}
|
||||
|
||||
// return ofs (int)
|
||||
Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
|
||||
set_result(result);
|
||||
|
@ -6371,9 +6409,9 @@ bool LibraryCallKit::inline_digestBase_implCompressMB(Node* digestBase_obj, ciIn
|
|||
}
|
||||
|
||||
//------------------------------get_state_from_digest_object-----------------------
|
||||
Node * LibraryCallKit::get_state_from_digest_object(Node *digest_object) {
|
||||
Node* digest_state = load_field_from_object(digest_object, "state", "[I", /*is_exact*/ false);
|
||||
assert (digest_state != NULL, "wrong version of sun.security.provider.MD5/SHA/SHA2");
|
||||
Node * LibraryCallKit::get_state_from_digest_object(Node *digest_object, const char *state_type) {
|
||||
Node* digest_state = load_field_from_object(digest_object, "state", state_type, /*is_exact*/ false);
|
||||
assert (digest_state != NULL, "wrong version of sun.security.provider.MD5/SHA/SHA2/SHA5/SHA3");
|
||||
if (digest_state == NULL) return (Node *) NULL;
|
||||
|
||||
// now have the array, need to get the start address of the state array
|
||||
|
@ -6381,26 +6419,22 @@ Node * LibraryCallKit::get_state_from_digest_object(Node *digest_object) {
|
|||
return state;
|
||||
}
|
||||
|
||||
//------------------------------get_long_state_from_digest_object-----------------------
|
||||
Node * LibraryCallKit::get_long_state_from_digest_object(Node *digest_object) {
|
||||
Node* digest_state = load_field_from_object(digest_object, "state", "[J", /*is_exact*/ false);
|
||||
assert (digest_state != NULL, "wrong version of sun.security.provider.SHA5");
|
||||
if (digest_state == NULL) return (Node *) NULL;
|
||||
|
||||
// now have the array, need to get the start address of the state array
|
||||
Node* state = array_element_address(digest_state, intcon(0), T_LONG);
|
||||
return state;
|
||||
//------------------------------get_digest_length_from_sha3_object----------------------------------
|
||||
Node * LibraryCallKit::get_digest_length_from_digest_object(Node *digest_object) {
|
||||
Node* digest_length = load_field_from_object(digest_object, "digestLength", "I", /*is_exact*/ false);
|
||||
assert (digest_length != NULL, "sanity");
|
||||
return digest_length;
|
||||
}
|
||||
|
||||
//----------------------------inline_digestBase_implCompressMB_predicate----------------------------
|
||||
// Return node representing slow path of predicate check.
|
||||
// the pseudo code we want to emulate with this predicate is:
|
||||
// if (digestBaseObj instanceof MD5/SHA/SHA2/SHA5) do_intrinsic, else do_javapath
|
||||
// if (digestBaseObj instanceof MD5/SHA/SHA2/SHA5/SHA3) do_intrinsic, else do_javapath
|
||||
//
|
||||
Node* LibraryCallKit::inline_digestBase_implCompressMB_predicate(int predicate) {
|
||||
assert(UseMD5Intrinsics || UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics,
|
||||
"need MD5/SHA1/SHA256/SHA512 instruction support");
|
||||
assert((uint)predicate < 4, "sanity");
|
||||
assert(UseMD5Intrinsics || UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics || UseSHA3Intrinsics,
|
||||
"need MD5/SHA1/SHA256/SHA512/SHA3 instruction support");
|
||||
assert((uint)predicate < 5, "sanity");
|
||||
|
||||
// The receiver was checked for NULL already.
|
||||
Node* digestBaseObj = argument(0);
|
||||
|
@ -6436,6 +6470,12 @@ Node* LibraryCallKit::inline_digestBase_implCompressMB_predicate(int predicate)
|
|||
klass_name = "sun/security/provider/SHA5";
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (UseSHA3Intrinsics) {
|
||||
// we want to do an instanceof comparison against the SHA3 class
|
||||
klass_name = "sun/security/provider/SHA3";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fatal("unknown SHA intrinsic predicate: %d", predicate);
|
||||
}
|
||||
|
|
|
@ -279,10 +279,10 @@ class LibraryCallKit : public GraphKit {
|
|||
bool inline_digestBase_implCompress(vmIntrinsics::ID id);
|
||||
bool inline_digestBase_implCompressMB(int predicate);
|
||||
bool inline_digestBase_implCompressMB(Node* digestBaseObj, ciInstanceKlass* instklass,
|
||||
bool long_state, address stubAddr, const char *stubName,
|
||||
const char* state_type, address stubAddr, const char *stubName,
|
||||
Node* src_start, Node* ofs, Node* limit);
|
||||
Node* get_state_from_digest_object(Node *digestBase_object);
|
||||
Node* get_long_state_from_digest_object(Node *digestBase_object);
|
||||
Node* get_state_from_digest_object(Node *digestBase_object, const char* state_type);
|
||||
Node* get_digest_length_from_digest_object(Node *digestBase_object);
|
||||
Node* inline_digestBase_implCompressMB_predicate(int predicate);
|
||||
bool inline_encodeISOArray();
|
||||
bool inline_updateCRC32();
|
||||
|
|
|
@ -961,14 +961,15 @@ const TypeFunc* OptoRuntime::counterMode_aescrypt_Type() {
|
|||
/*
|
||||
* void implCompress(byte[] buf, int ofs)
|
||||
*/
|
||||
const TypeFunc* OptoRuntime::digestBase_implCompress_Type() {
|
||||
const TypeFunc* OptoRuntime::digestBase_implCompress_Type(bool is_sha3) {
|
||||
// create input type (domain)
|
||||
int num_args = 2;
|
||||
int num_args = is_sha3 ? 3 : 2;
|
||||
int argcnt = num_args;
|
||||
const Type** fields = TypeTuple::fields(argcnt);
|
||||
int argp = TypeFunc::Parms;
|
||||
fields[argp++] = TypePtr::NOTNULL; // buf
|
||||
fields[argp++] = TypePtr::NOTNULL; // state
|
||||
if (is_sha3) fields[argp++] = TypeInt::INT; // digest_length
|
||||
assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
|
||||
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
|
||||
|
||||
|
@ -982,14 +983,15 @@ const TypeFunc* OptoRuntime::digestBase_implCompress_Type() {
|
|||
/*
|
||||
* int implCompressMultiBlock(byte[] b, int ofs, int limit)
|
||||
*/
|
||||
const TypeFunc* OptoRuntime::digestBase_implCompressMB_Type() {
|
||||
const TypeFunc* OptoRuntime::digestBase_implCompressMB_Type(bool is_sha3) {
|
||||
// create input type (domain)
|
||||
int num_args = 4;
|
||||
int num_args = is_sha3 ? 5 : 4;
|
||||
int argcnt = num_args;
|
||||
const Type** fields = TypeTuple::fields(argcnt);
|
||||
int argp = TypeFunc::Parms;
|
||||
fields[argp++] = TypePtr::NOTNULL; // buf
|
||||
fields[argp++] = TypePtr::NOTNULL; // state
|
||||
if (is_sha3) fields[argp++] = TypeInt::INT; // digest_length
|
||||
fields[argp++] = TypeInt::INT; // ofs
|
||||
fields[argp++] = TypeInt::INT; // limit
|
||||
assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
|
||||
|
|
|
@ -278,8 +278,8 @@ private:
|
|||
static const TypeFunc* electronicCodeBook_aescrypt_Type();
|
||||
static const TypeFunc* counterMode_aescrypt_Type();
|
||||
|
||||
static const TypeFunc* digestBase_implCompress_Type();
|
||||
static const TypeFunc* digestBase_implCompressMB_Type();
|
||||
static const TypeFunc* digestBase_implCompress_Type(bool is_sha3);
|
||||
static const TypeFunc* digestBase_implCompressMB_Type(bool is_sha3);
|
||||
|
||||
static const TypeFunc* multiplyToLen_Type();
|
||||
static const TypeFunc* montgomeryMultiply_Type();
|
||||
|
|
|
@ -345,6 +345,10 @@ const intx ObjectAlignmentInBytes = 8;
|
|||
"Use intrinsics for SHA-384 and SHA-512 crypto hash functions. " \
|
||||
"Requires that UseSHA is enabled.") \
|
||||
\
|
||||
product(bool, UseSHA3Intrinsics, false, DIAGNOSTIC, \
|
||||
"Use intrinsics for SHA3 crypto hash function. " \
|
||||
"Requires that UseSHA is enabled.") \
|
||||
\
|
||||
product(bool, UseCRC32Intrinsics, false, DIAGNOSTIC, \
|
||||
"use intrinsics for java.util.zip.CRC32") \
|
||||
\
|
||||
|
|
|
@ -146,6 +146,8 @@ address StubRoutines::_sha256_implCompress = NULL;
|
|||
address StubRoutines::_sha256_implCompressMB = NULL;
|
||||
address StubRoutines::_sha512_implCompress = NULL;
|
||||
address StubRoutines::_sha512_implCompressMB = NULL;
|
||||
address StubRoutines::_sha3_implCompress = NULL;
|
||||
address StubRoutines::_sha3_implCompressMB = NULL;
|
||||
|
||||
address StubRoutines::_updateBytesCRC32 = NULL;
|
||||
address StubRoutines::_crc_table_adr = NULL;
|
||||
|
|
|
@ -228,6 +228,8 @@ class StubRoutines: AllStatic {
|
|||
static address _sha256_implCompressMB;
|
||||
static address _sha512_implCompress;
|
||||
static address _sha512_implCompressMB;
|
||||
static address _sha3_implCompress;
|
||||
static address _sha3_implCompressMB;
|
||||
|
||||
static address _updateBytesCRC32;
|
||||
static address _crc_table_adr;
|
||||
|
@ -407,6 +409,8 @@ class StubRoutines: AllStatic {
|
|||
static address sha256_implCompressMB() { return _sha256_implCompressMB; }
|
||||
static address sha512_implCompress() { return _sha512_implCompress; }
|
||||
static address sha512_implCompressMB() { return _sha512_implCompressMB; }
|
||||
static address sha3_implCompress() { return _sha3_implCompress; }
|
||||
static address sha3_implCompressMB() { return _sha3_implCompressMB; }
|
||||
|
||||
static address updateBytesCRC32() { return _updateBytesCRC32; }
|
||||
static address crc_table_addr() { return _crc_table_adr; }
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
package sun.security.provider;
|
||||
|
||||
import jdk.internal.vm.annotation.IntrinsicCandidate;
|
||||
import static sun.security.provider.ByteArrayAccess.*;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
|
@ -73,15 +74,25 @@ abstract class SHA3 extends DigestBase {
|
|||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
private void implCompressCheck(byte[] b, int ofs) {
|
||||
Objects.requireNonNull(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Core compression function. Processes blockSize bytes at a time
|
||||
* and updates the state of this object.
|
||||
*/
|
||||
void implCompress(byte[] b, int ofs) {
|
||||
for (int i = 0; i < buffer.length; i++) {
|
||||
state[i] ^= b[ofs++];
|
||||
}
|
||||
keccak();
|
||||
implCompressCheck(b, ofs);
|
||||
implCompress0(b, ofs);
|
||||
}
|
||||
|
||||
@IntrinsicCandidate
|
||||
private void implCompress0(byte[] b, int ofs) {
|
||||
for (int i = 0; i < buffer.length; i++) {
|
||||
state[i] ^= b[ofs++];
|
||||
}
|
||||
keccak();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,10 +105,7 @@ abstract class SHA3 extends DigestBase {
|
|||
if (numOfPadding < 1) {
|
||||
throw new ProviderException("Incorrect pad size: " + numOfPadding);
|
||||
}
|
||||
for (int i = 0; i < buffer.length; i++) {
|
||||
state[i] ^= buffer[i];
|
||||
}
|
||||
keccak();
|
||||
implCompress(buffer, 0);
|
||||
System.arraycopy(state, 0, out, ofs, engineGetDigestLength());
|
||||
}
|
||||
|
||||
|
|
|
@ -608,6 +608,10 @@ public class CheckGraalIntrinsics extends GraalTest {
|
|||
if (!config.useSHA512Intrinsics()) {
|
||||
add(ignore, "sun/security/provider/SHA5." + shaCompressName + "([BI)V");
|
||||
}
|
||||
|
||||
if (isJDK16OrHigher()) {
|
||||
add(toBeInvestigated, "sun/security/provider/SHA3." + shaCompressName + "([BI)V");
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isJDK9OrHigher() {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/**
|
||||
* @test
|
||||
* @bug 8035968
|
||||
* @summary C2 support for MD5/SHA-1/SHA-224/SHA-256/SHA-384/SHA-512
|
||||
* @summary C2 support for MD5/SHA-1/SHA-224/SHA-256/SHA-384/SHA-512/SHA3
|
||||
*
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=MD5
|
||||
|
@ -44,6 +44,18 @@
|
|||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA-512
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-224
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-256
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-384
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-512
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
*
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=MD5 -Doffset=1
|
||||
|
@ -63,6 +75,18 @@
|
|||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA-512 -Doffset=1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-224 -Doffset=1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-256 -Doffset=1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-384 -Doffset=1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-512 -Doffset=1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
*
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA-1 -Dalgorithm2=SHA-256
|
||||
|
@ -80,6 +104,31 @@
|
|||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=MD5 -Dalgorithm2=SHA-1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
*
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA-1 -Dalgorithm2=SHA3-224
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA-1 -Dalgorithm2=SHA3-256
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA-1 -Dalgorithm2=SHA3-384
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA-1 -Dalgorithm2=SHA3-512
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-224 -Dalgorithm2=SHA-1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-256 -Dalgorithm2=SHA-1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-384 -Dalgorithm2=SHA-1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
* @run main/othervm/timeout=600 -Xbatch
|
||||
* -Dalgorithm=SHA3-512 -Dalgorithm2=SHA-1
|
||||
* compiler.intrinsics.sha.TestDigest
|
||||
*/
|
||||
|
||||
package compiler.intrinsics.sha;
|
||||
|
|
|
@ -45,6 +45,8 @@ public class DigestOptionsBase extends CommandLineOptionTest {
|
|||
= "UseSHA256Intrinsics";
|
||||
public static final String USE_SHA512_INTRINSICS_OPTION
|
||||
= "UseSHA512Intrinsics";
|
||||
public static final String USE_SHA3_INTRINSICS_OPTION
|
||||
= "UseSHA3Intrinsics";
|
||||
|
||||
// Intrinsics flags are of diagnostic type
|
||||
// and must be preceded by UnlockDiagnosticVMOptions.
|
||||
|
@ -64,6 +66,8 @@ public class DigestOptionsBase extends CommandLineOptionTest {
|
|||
= "Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.";
|
||||
protected static final String SHA512_INTRINSICS_ARE_NOT_AVAILABLE
|
||||
= "Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.";
|
||||
protected static final String SHA3_INTRINSICS_ARE_NOT_AVAILABLE
|
||||
= "Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU.";
|
||||
|
||||
private final TestCase[] testCases;
|
||||
|
||||
|
@ -89,6 +93,8 @@ public class DigestOptionsBase extends CommandLineOptionTest {
|
|||
return DigestOptionsBase.SHA256_INTRINSICS_ARE_NOT_AVAILABLE;
|
||||
case DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION:
|
||||
return DigestOptionsBase.SHA512_INTRINSICS_ARE_NOT_AVAILABLE;
|
||||
case DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION:
|
||||
return DigestOptionsBase.SHA3_INTRINSICS_ARE_NOT_AVAILABLE;
|
||||
default:
|
||||
throw new Error("Unexpected option " + optionName);
|
||||
}
|
||||
|
@ -115,6 +121,8 @@ public class DigestOptionsBase extends CommandLineOptionTest {
|
|||
return IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE;
|
||||
case DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION:
|
||||
return IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE;
|
||||
case DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION:
|
||||
return IntrinsicPredicates.SHA3_INSTRUCTION_AVAILABLE;
|
||||
default:
|
||||
throw new Error("Unexpected option " + optionName);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Huawei Technologies Co. Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8252204
|
||||
* @summary Verify UseSHA3Intrinsics option processing on supported CPU.
|
||||
* @library /test/lib testcases /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
*
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI
|
||||
* compiler.intrinsics.sha.cli.TestUseSHA3IntrinsicsOptionOnSupportedCPU
|
||||
*/
|
||||
|
||||
package compiler.intrinsics.sha.cli;
|
||||
|
||||
import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForSupportedCPU;
|
||||
|
||||
public class TestUseSHA3IntrinsicsOptionOnSupportedCPU {
|
||||
public static void main(String args[]) throws Throwable {
|
||||
new DigestOptionsBase(new GenericTestCaseForSupportedCPU(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION)).test();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Huawei Technologies Co. Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8252204
|
||||
* @summary Verify UseSHA3Intrinsics option processing on unsupported CPU.
|
||||
* @library /test/lib testcases /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
*
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI
|
||||
* compiler.intrinsics.sha.cli.TestUseSHA3IntrinsicsOptionOnUnsupportedCPU
|
||||
*/
|
||||
|
||||
package compiler.intrinsics.sha.cli;
|
||||
|
||||
import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForOtherCPU;
|
||||
import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedAArch64CPU;
|
||||
import compiler.intrinsics.sha.cli.testcases.GenericTestCaseForUnsupportedX86CPU;
|
||||
import compiler.intrinsics.sha.cli.testcases.UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU;
|
||||
|
||||
public class TestUseSHA3IntrinsicsOptionOnUnsupportedCPU {
|
||||
public static void main(String args[]) throws Throwable {
|
||||
new DigestOptionsBase(
|
||||
new GenericTestCaseForUnsupportedX86CPU(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION),
|
||||
new GenericTestCaseForUnsupportedAArch64CPU(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION),
|
||||
new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION),
|
||||
new GenericTestCaseForOtherCPU(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION)).test();
|
||||
}
|
||||
}
|
|
@ -66,7 +66,9 @@ public class UseSHASpecificTestCaseForSupportedCPU
|
|||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, false));
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,7 +85,9 @@ public class UseSHASpecificTestCaseForSupportedCPU
|
|||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, false));
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION, false));
|
||||
|
||||
CommandLineOptionTest.verifyOptionValueForSameVM(
|
||||
// Verify that UseSHA is disabled when all UseSHA*Intrinsics are
|
||||
|
@ -102,7 +106,9 @@ public class UseSHASpecificTestCaseForSupportedCPU
|
|||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, false));
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION, false));
|
||||
|
||||
// Verify that explicitly disabled UseSHA option remains disabled even
|
||||
// if all UseSHA*Intrinsics options were enabled.
|
||||
|
@ -121,6 +127,8 @@ public class UseSHASpecificTestCaseForSupportedCPU
|
|||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, true),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION, true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,9 @@ public class UseSHASpecificTestCaseForUnsupportedCPU
|
|||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, true),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION, true));
|
||||
|
||||
// Verify that UseSHA option remains disabled even if all
|
||||
// UseSHA*Intrinsics options were enabled and UseSHA was enabled as well.
|
||||
|
@ -94,6 +96,8 @@ public class UseSHASpecificTestCaseForUnsupportedCPU
|
|||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
|
||||
DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION, true),
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION, true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ public class DigestSanityTestBase {
|
|||
= "_sha2_implCompress";
|
||||
protected static final String SHA512_INTRINSIC_ID
|
||||
= "_sha5_implCompress";
|
||||
protected static final String SHA3_INTRINSIC_ID
|
||||
= "_sha3_implCompress";
|
||||
protected static final String MB_INTRINSIC_ID
|
||||
= "_digestBase_implCompressMB";
|
||||
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Huawei Technologies Co. Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8252204
|
||||
* @summary Verify that SHA3-224, SHA3-256, SHA3-384, SHA3-512 intrinsic is actually used.
|
||||
* @comment the test verifies compilation of java.base methods, so it can't be run w/ AOT'ed java.base
|
||||
* @requires !vm.aot.enabled
|
||||
*
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
*
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_224.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics
|
||||
* -Dalgorithm=SHA3-224
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3Intrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=negative_224.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:-UseSHA3Intrinsics
|
||||
* -Dalgorithm=SHA3-224
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3Intrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_256.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics
|
||||
* -Dalgorithm=SHA3-256
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3Intrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=negative_256.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:-UseSHA3Intrinsics
|
||||
* -Dalgorithm=SHA3-256
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3Intrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_384.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics
|
||||
* -Dalgorithm=SHA3-384
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3Intrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=negative_384.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:-UseSHA3Intrinsics
|
||||
* -Dalgorithm=SHA3-384
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3Intrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_512.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics
|
||||
* -Dalgorithm=SHA3-512
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3Intrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=negative_512.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:-UseSHA3Intrinsics
|
||||
* -Dalgorithm=SHA3-512
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3Intrinsics
|
||||
* @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
|
||||
* compiler.testlibrary.intrinsics.Verifier positive_224.log positive_256.log positive_384.log positive_512.log
|
||||
* negative_224.log negative_256.log negative_384.log negative_512.log
|
||||
*/
|
||||
|
||||
package compiler.intrinsics.sha.sanity;
|
||||
|
||||
import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
|
||||
|
||||
public class TestSHA3Intrinsics {
|
||||
public static void main(String args[]) throws Exception {
|
||||
new DigestSanityTestBase(IntrinsicPredicates.isSHA3IntrinsicAvailable(),
|
||||
DigestSanityTestBase.SHA3_INTRINSIC_ID).test();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Huawei Technologies Co. Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8252204
|
||||
* @summary Verify that SHA3-224, SHA3-256, SHA3-384, SHA3-512 multi block intrinsic is actually used.
|
||||
* @comment the test verifies compilation of java.base methods, so it can't be run w/ AOT'ed java.base
|
||||
* @requires !vm.aot.enabled
|
||||
*
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
*
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_224.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics -XX:-UseMD5Intrinsics
|
||||
* -XX:-UseSHA1Intrinsics -XX:-UseSHA256Intrinsics
|
||||
* -XX:-UseSHA512Intrinsics -Dalgorithm=SHA3-224
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_224_def.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics -Dalgorithm=SHA3-224
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=negative_224.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3 -XX:-UseSHA
|
||||
* -Dalgorithm=SHA3-224
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
*
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_256.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics -XX:-UseMD5Intrinsics
|
||||
* -XX:-UseSHA1Intrinsics -XX:-UseSHA256Intrinsics
|
||||
* -XX:-UseSHA512Intrinsics -Dalgorithm=SHA3-256
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_256_def.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics -Dalgorithm=SHA3-256
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=negative_256.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3 -XX:-UseSHA
|
||||
* -Dalgorithm=SHA3-256
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
*
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_384.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics -XX:-UseMD5Intrinsics
|
||||
* -XX:-UseSHA1Intrinsics -XX:-UseSHA256Intrinsics
|
||||
* -XX:-UseSHA512Intrinsics -Dalgorithm=SHA3-384
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_384_def.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics -Dalgorithm=SHA3-384
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=negative_384.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3 -XX:-UseSHA
|
||||
* -Dalgorithm=SHA3-384
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
*
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_512.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics -XX:-UseMD5Intrinsics
|
||||
* -XX:-UseSHA1Intrinsics -XX:-UseSHA256Intrinsics
|
||||
* -XX:-UseSHA512Intrinsics -Dalgorithm=SHA3-512
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=positive_512_def.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3
|
||||
* -XX:+UseSHA3Intrinsics -Dalgorithm=SHA3-512
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
|
||||
* -XX:Tier4InvocationThreshold=500
|
||||
* -XX:+LogCompilation -XX:LogFile=negative_512.log
|
||||
* -XX:CompileOnly=sun/security/provider/DigestBase
|
||||
* -XX:CompileOnly=sun/security/provider/SHA3 -XX:-UseSHA
|
||||
* -Dalgorithm=SHA3-512
|
||||
* compiler.intrinsics.sha.sanity.TestSHA3MultiBlockIntrinsics
|
||||
* @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
|
||||
* compiler.testlibrary.intrinsics.Verifier positive_224.log positive_256.log
|
||||
* positive_384.log positive_512.log positive_224_def.log positive_256_def.log
|
||||
* positive_384_def.log positive_512_def.log negative_224.log negative_256.log
|
||||
* negative_384.log negative_512.log
|
||||
*/
|
||||
|
||||
package compiler.intrinsics.sha.sanity;
|
||||
|
||||
import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
|
||||
|
||||
public class TestSHA3MultiBlockIntrinsics {
|
||||
public static void main(String args[]) throws Exception {
|
||||
new DigestSanityTestBase(IntrinsicPredicates.isSHA3IntrinsicAvailable(),
|
||||
DigestSanityTestBase.MB_INTRINSIC_ID).test();
|
||||
}
|
||||
}
|
|
@ -97,11 +97,14 @@ public class IntrinsicPredicates {
|
|||
new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "avx2", "bmi2" }, null),
|
||||
new CPUSpecificPredicate("x86_64", new String[] { "avx2", "bmi2" }, null)))))))));
|
||||
|
||||
public static final BooleanSupplier SHA3_INSTRUCTION_AVAILABLE
|
||||
// sha3 is only implemented on aarch64 for now
|
||||
= new CPUSpecificPredicate("aarch64.*", new String[] {"sha3" }, null);
|
||||
|
||||
public static final BooleanSupplier ANY_SHA_INSTRUCTION_AVAILABLE
|
||||
= new OrPredicate(IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE,
|
||||
new OrPredicate(
|
||||
IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE,
|
||||
IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE));
|
||||
new OrPredicate(IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE,
|
||||
new OrPredicate(IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE, IntrinsicPredicates.SHA3_INSTRUCTION_AVAILABLE)));
|
||||
|
||||
public static BooleanSupplier isMD5IntrinsicAvailable() {
|
||||
return new AndPredicate(IntrinsicPredicates.COMPILABLE_BY_C2,
|
||||
|
@ -123,6 +126,11 @@ public class IntrinsicPredicates {
|
|||
IntrinsicPredicates.isIntrinsicAvailable("sun.security.provider.SHA5", "implCompress0"));
|
||||
}
|
||||
|
||||
public static BooleanSupplier isSHA3IntrinsicAvailable() {
|
||||
return new AndPredicate(IntrinsicPredicates.COMPILABLE_BY_C2,
|
||||
IntrinsicPredicates.isIntrinsicAvailable("sun.security.provider.SHA3", "implCompress0"));
|
||||
}
|
||||
|
||||
private static BooleanSupplier isIntrinsicAvailable(String klass, String method) {
|
||||
try {
|
||||
Method m = Class.forName(klass).getDeclaredMethod(method, byte[].class, int.class);
|
||||
|
|
103
test/jdk/sun/security/provider/MessageDigest/SHA3.java
Normal file
103
test/jdk/sun/security/provider/MessageDigest/SHA3.java
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Huawei Technologies Co. Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8252204
|
||||
* @library /test/lib
|
||||
* @summary testing SHA3-224/256/384/512.
|
||||
*/
|
||||
public class SHA3 {
|
||||
|
||||
static byte[] msg1600bits;
|
||||
static {
|
||||
msg1600bits = new byte[200];
|
||||
for (int i = 0; i < 200; i++)
|
||||
msg1600bits[i] = (byte) 0xa3;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
MessageDigest md;
|
||||
|
||||
// Test vectors obtained from
|
||||
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-224_Msg0.pdf
|
||||
md = MessageDigest.getInstance("SHA3-224");
|
||||
Asserts.assertTrue(Arrays.equals(md.digest("".getBytes()),
|
||||
xeh("6B4E0342 3667DBB7 3B6E1545 4F0EB1AB D4597F9A 1B078E3F 5B5A6BC7")));
|
||||
// Test vectors obtained from
|
||||
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-224_1600.pdf
|
||||
Asserts.assertTrue(Arrays.equals(md.digest(msg1600bits),
|
||||
xeh("9376816A BA503F72 F96CE7EB 65AC095D EEE3BE4B F9BBC2A1 CB7E11E0")));
|
||||
|
||||
// Test vectors obtained from
|
||||
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-256_Msg0.pdf
|
||||
md = MessageDigest.getInstance("SHA3-256");
|
||||
Asserts.assertTrue(Arrays.equals(md.digest("".getBytes()),
|
||||
xeh("A7FFC6F8 BF1ED766 51C14756 A061D662 F580FF4D E43B49FA 82D80A4B 80F8434A")));
|
||||
// Test vectors obtained from
|
||||
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-256_1600.pdf
|
||||
Asserts.assertTrue(Arrays.equals(md.digest(msg1600bits),
|
||||
xeh("79F38ADE C5C20307 A98EF76E 8324AFBF D46CFD81 B22E3973 C65FA1BD 9DE31787")));
|
||||
|
||||
// Test vectors obtained from
|
||||
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-384_Msg0.pdf
|
||||
md = MessageDigest.getInstance("SHA3-384");
|
||||
Asserts.assertTrue(Arrays.equals(md.digest("".getBytes()),
|
||||
xeh("0C63A75B 845E4F7D 01107D85 2E4C2485 C51A50AA AA94FC61 995E71BB EE983A2A" +
|
||||
"C3713831 264ADB47 FB6BD1E0 58D5F004")));
|
||||
// Test vectors obtained from
|
||||
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-384_1600.pdf
|
||||
Asserts.assertTrue(Arrays.equals(md.digest(msg1600bits),
|
||||
xeh("1881DE2C A7E41EF9 5DC4732B 8F5F002B 189CC1E4 2B74168E D1732649 CE1DBCDD" +
|
||||
"76197A31 FD55EE98 9F2D7050 DD473E8F")));
|
||||
|
||||
// Test vectors obtained from
|
||||
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-512_Msg0.pdf
|
||||
md = MessageDigest.getInstance("SHA3-512");
|
||||
Asserts.assertTrue(Arrays.equals(md.digest("".getBytes()),
|
||||
xeh("A69F73CC A23A9AC5 C8B567DC 185A756E 97C98216 4FE25859 E0D1DCC1 475C80A6" +
|
||||
"15B2123A F1F5F94C 11E3E940 2C3AC558 F500199D 95B6D3E3 01758586 281DCD26")));
|
||||
// Test vectors obtaned from
|
||||
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-512_1600.pdf
|
||||
Asserts.assertTrue(Arrays.equals(md.digest(msg1600bits),
|
||||
xeh("E76DFAD2 2084A8B1 467FCF2F FA58361B EC7628ED F5F3FDC0 E4805DC4 8CAEECA8" +
|
||||
"1B7C13C3 0ADF52A3 65958473 9A2DF46B E589C51C A1A4A841 6DF6545A 1CE8BA00")));
|
||||
}
|
||||
|
||||
static byte[] xeh(String in) {
|
||||
in = in.replaceAll(" ", "");
|
||||
int len = in.length() / 2;
|
||||
byte[] out = new byte[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
out[i] = (byte)Integer.parseInt(in.substring(i * 2, i * 2 + 2), 16);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -53,7 +53,7 @@ public class MessageDigests {
|
|||
@Param({"64", "1024", "16384"})
|
||||
private int length;
|
||||
|
||||
@Param({"md2", "md5", "SHA-1", "SHA-224", "SHA-256", "SHA-384", "SHA-512"})
|
||||
@Param({"md2", "md5", "SHA-1", "SHA-224", "SHA-256", "SHA-384", "SHA-512", "SHA3-224", "SHA3-256", "SHA3-384", "SHA3-512"})
|
||||
private String digesterName;
|
||||
|
||||
@Param({"DEFAULT", "SUN"})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue