RFR: JDK-8216437 : PPC64: Add intrinsic for GHASH algorithm [v31]

Suchismith Roy sroy at openjdk.org
Mon Apr 28 09:10:55 UTC 2025


On Thu, 24 Apr 2025 14:13:50 GMT, Suchismith Roy <sroy at openjdk.org> wrote:

>> JBS Issue : [JDK-8216437](https://bugs.openjdk.org/browse/JDK-8216437)
>> 
>> Currently acceleration code for GHASH is missing for PPC64. 
>> 
>> The current implementation utlilises SIMD instructions on Power and uses Karatsuba multiplication for obtaining the final result.
>
> Suchismith Roy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   masm

**Runtime without my changes** 

~/jdkHead/jdk/build/linux-ppc64le-server-fastdebug/jdk/bin/java  -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1  -XX:DisableIntrinsic=_ghash_processBlocks  -XX:+UnlockDiagnosticVMOptions -Xbootclasspath/a:. -cp . compiler.codegen.aes.TestAESMain 100000 100000

The output is as belows

100000 iterations
For random generator using seed: 7133744594045351839
To re-run test with same seed value please add "-Djdk.test.lib.random.seed=7133744594045351839" to command line.
 
algorithm=AES, mode=GCM, paddingStr=NoPadding, msgSize=646, keySize=128, noReinit=false, checkOutput=true, encInputOffset=1, encOutputOffset=1, decOutputOffset=0, lastChunkSize=32
Algorithm: AES(128bit)
Encryption cipher provider: SunJCE version 24
Encryption cipher algorithm: AES/GCM/NoPadding
key:     [16]: f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 
input:   [647]: 00 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 
encode:  [671]: 00 7c 9d 30 e5 43 96 fd 53 28 c4 08 16 99 58 b2 60 a6 81 22 51 d9 fd f6 ab d7 4b f2 c9 1f d9 c6 
decode:  [647]: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 
Starting encryption warm-up
Finished encryption warm-up
**TestAESEncode runtime was 1495.395126 ms**
 
algorithm=AES, mode=GCM, paddingStr=NoPadding, msgSize=646, keySize=128, noReinit=false, checkOutput=true, encInputOffset=1, encOutputOffset=1, decOutputOffset=0, lastChunkSize=32
Algorithm: AES(128bit)
Decryption cipher provider: SunJCE version 24
Decryption cipher algorithm: AES/GCM/NoPadding
key:     [16]: f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 
input:   [647]: 00 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 
encode:  [671]: 00 7c 9d 30 e5 43 96 fd 53 28 c4 08 16 99 58 b2 60 a6 81 22 51 d9 fd f6 ab d7 4b f2 c9 1f d9 c6 
decode:  [647]: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 
Starting decryption warm-up
Finished decryption warm-up
**TestAESDecode runtime was 1378.752962 ms**

**Runtime with changes** 


~/jdkHead/jdk/build/linux-ppc64le-server-fastdebug/jdk/bin/java  -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1  -XX:+UnlockDiagnosticVMOptions -Xbootclasspath/a:. -cp . compiler.codegen.aes.TestAESMain 100000 100000
 

The output is a below
100000 iterations
For random generator using seed: 1980542562394450893
To re-run test with same seed value please add "-Djdk.test.lib.random.seed=1980542562394450893" to command line.
 
algorithm=AES, mode=GCM, paddingStr=NoPadding, msgSize=646, keySize=128, noReinit=false, checkOutput=true, encInputOffset=1, encOutputOffset=1, decOutputOffset=0, lastChunkSize=32
Algorithm: AES(128bit)
Encryption cipher provider: SunJCE version 24
Encryption cipher algorithm: AES/GCM/NoPadding
key:     [16]: f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 
input:   [647]: 00 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 
encode:  [671]: 00 7c 9d 30 e5 43 96 fd 53 28 c4 08 16 99 58 b2 60 a6 81 22 51 d9 fd f6 ab d7 4b f2 c9 1f d9 c6 
decode:  [647]: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 
Starting encryption warm-up
Finished encryption warm-up
**TestAESEncode runtime was 565.673321 ms**
 
algorithm=AES, mode=GCM, paddingStr=NoPadding, msgSize=646, keySize=128, noReinit=false, checkOutput=true, encInputOffset=1, encOutputOffset=1, decOutputOffset=0, lastChunkSize=32
Algorithm: AES(128bit)
Decryption cipher provider: SunJCE version 24
Decryption cipher algorithm: AES/GCM/NoPadding
key:     [16]: f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 
input:   [647]: 00 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 
encode:  [671]: 00 7c 9d 30 e5 43 96 fd 53 28 c4 08 16 99 58 b2 60 a6 81 22 51 d9 fd f6 ab d7 4b f2 c9 1f d9 c6 
decode:  [647]: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 
Starting decryption warm-up
Finished decryption warm-up
**TestAESDecode runtime was 459.795885 ms**

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20235#issuecomment-2834537320
PR Comment: https://git.openjdk.org/jdk/pull/20235#issuecomment-2834538796


More information about the hotspot-dev mailing list