4646
4747import java .util .Arrays ;
4848
49+ import jdk .vm .ci .aarch64 .AArch64Kind ;
4950import org .graalvm .compiler .asm .Label ;
5051import org .graalvm .compiler .asm .aarch64 .AArch64ASIMDAssembler .ASIMDSize ;
5152import org .graalvm .compiler .asm .aarch64 .AArch64ASIMDAssembler .ElementSize ;
@@ -107,6 +108,11 @@ public AArch64GHASHProcessBlocksOp(LIRGeneratorTool tool, AllocatableValue state
107108
108109 @ Override
109110 public void emitCode (CompilationResultBuilder crb , AArch64MacroAssembler masm ) {
111+ assert stateValue .getPlatformKind ().equals (AArch64Kind .QWORD ) : stateValue ;
112+ assert htblValue .getPlatformKind ().equals (AArch64Kind .QWORD ) : htblValue ;
113+ assert originalDataValue .getPlatformKind ().equals (AArch64Kind .QWORD ) : originalDataValue ;
114+ assert originalBlocksValue .getPlatformKind ().equals (AArch64Kind .DWORD ) : originalBlocksValue ;
115+
110116 Label labelSmall = new Label ();
111117 Label labelDone = new Label ();
112118
@@ -119,7 +125,7 @@ public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
119125 Register blocks = asRegister (blocksValue );
120126
121127 masm .mov (64 , data , originalData );
122- masm .mov (64 , blocks , originalBlocks );
128+ masm .mov (32 , blocks , originalBlocks );
123129
124130 masm .compare (32 , blocks , 8 );
125131 masm .branchConditionally (ConditionFlag .LT , labelSmall );
@@ -387,8 +393,8 @@ private static void ghashProcessBlocksWide(AArch64MacroAssembler masm,
387393 /* temp */ v3 ,
388394 true ).unroll ();
389395
390- masm .sub (64 , blocks , blocks , unrolls );
391- masm .compare (64 , blocks , unrolls * 2 );
396+ masm .sub (32 , blocks , blocks , unrolls );
397+ masm .compare (32 , blocks , unrolls * 2 );
392398 masm .branchConditionally (ConditionFlag .GE , labelGHASHLoop );
393399
394400 // Merge the #unrolls states. Note that the data for the next
@@ -429,7 +435,7 @@ private static void ghashProcessBlocksWide(AArch64MacroAssembler masm,
429435 masm .neon .eorVVV (ASIMDSize .FullReg , v0 , v0 , offset (v0 , ofs + REGISTER_STRIDE ));
430436 }
431437
432- masm .sub (64 , blocks , blocks , unrolls );
438+ masm .sub (32 , blocks , blocks , unrolls );
433439
434440 // And finally bit-reverse the state back to big endian.
435441 masm .neon .rev64VV (ASIMDSize .FullReg , ElementSize .Byte , v0 , v0 );
0 commit comments