ARM64 assembly pack: make it Windows-friendly.
[openssl.git] / crypto / chacha / asm / chacha-armv8.pl
index cee787d..56ba1c3 100755 (executable)
@@ -131,12 +131,6 @@ $code.=<<___;
 .quad  0x3320646e61707865,0x6b20657479622d32           // endian-neutral
 .Lone:
 .long  1,0,0,0
-.LOPENSSL_armcap_P:
-#ifdef __ILP32__
-.long  OPENSSL_armcap_P-.
-#else
-.quad  OPENSSL_armcap_P-.
-#endif
 .asciz "ChaCha20 for ARMv8, CRYPTOGAMS by <appro\@openssl.org>"
 
 .globl ChaCha20_ctr32
@@ -144,17 +138,13 @@ $code.=<<___;
 .align 5
 ChaCha20_ctr32:
        cbz     $len,.Labort
-       adr     @x[0],.LOPENSSL_armcap_P
        cmp     $len,#192
        b.lo    .Lshort
-#ifdef __ILP32__
-       ldrsw   @x[1],[@x[0]]
-#else
-       ldr     @x[1],[@x[0]]
-#endif
-       ldr     w17,[@x[1],@x[0]]
+
+       adrp    x17,OPENSSL_armcap_P
+       ldr     w17,[x17,#:lo12:OPENSSL_armcap_P]
        tst     w17,#ARMV7_NEON
-       b.ne    ChaCha20_neon
+       b.ne    .LChaCha20_neon
 
 .Lshort:
        .inst   0xd503233f                      // paciasp
@@ -380,6 +370,7 @@ $code.=<<___;
 .type  ChaCha20_neon,%function
 .align 5
 ChaCha20_neon:
+.LChaCha20_neon:
        .inst   0xd503233f                      // paciasp
        stp     x29,x30,[sp,#-96]!
        add     x29,sp,#0