Skip to content

Commit 9a2c884

Browse files
authored
Merge pull request #8933 from SparkiDev/armv7a_asm_branch_fix
ARMv7a ASM: fix branch instruction
2 parents 8b61cd6 + 81e1eb4 commit 9a2c884

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

wolfcrypt/src/port/arm/armv8-chacha.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ static WC_INLINE int wc_Chacha_encrypt_256(
13641364
"ROR r4, r4, #25 \n\t" // 4 4
13651365
"VEXT.8 q11, q11, q11, #4 \n\t" // permute elements left by one
13661366

1367-
"B.NE L_chacha20_arm32_256_loop_%= \n\t"
1367+
"BNE L_chacha20_arm32_256_loop_%= \n\t"
13681368

13691369
// r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12
13701370
// 0 1 2 3 4 5 6 7 8 9 12 13 14
@@ -1736,7 +1736,7 @@ static WC_INLINE int wc_Chacha_encrypt_128(
17361736
"VEXT.8 q6, q6, q6, #8 \n\t" // permute elements left by two
17371737
"VEXT.8 q7, q7, q7, #4 \n\t" // permute elements left by one
17381738

1739-
"B.NE L_chacha20_arm32_128_loop_%= \n\t"
1739+
"BNE L_chacha20_arm32_128_loop_%= \n\t"
17401740

17411741
"VMOV.I32 q8, #0 \n\t"
17421742
"VADD.I32 q0, q0, q10 \n\t"
@@ -2816,7 +2816,7 @@ static WC_INLINE void wc_Chacha_encrypt_64(const word32* input, const byte* m,
28162816
"VADD.I32 q2, q2, q10 \n\t"
28172817
"VADD.I32 q3, q3, q11 \n\t"
28182818
"CMP %[bytes], #64 \n\t"
2819-
"B.LT L_chacha20_arm32_64_lt_64_%= \n\t"
2819+
"BLT L_chacha20_arm32_64_lt_64_%= \n\t"
28202820
/* XOR full 64 byte block */
28212821
"VLD1.8 { q4, q5 }, [%[m]]! \n\t"
28222822
"VLD1.8 { q6, q7 }, [%[m]]! \n\t"
@@ -2828,56 +2828,56 @@ static WC_INLINE void wc_Chacha_encrypt_64(const word32* input, const byte* m,
28282828
"VST1.8 { q2, q3 }, [%[c]]! \n\t"
28292829
"SUBS %[bytes], %[bytes], #64 \n\t"
28302830
"VADD.I32 q11, q11, q14 \n\t"
2831-
"B.NE L_chacha20_arm32_64_outer_loop_%= \n\t"
2831+
"BNE L_chacha20_arm32_64_outer_loop_%= \n\t"
28322832
"B L_chacha20_arm32_64_done_%= \n\t"
28332833
"\n"
28342834
"L_chacha20_arm32_64_lt_64_%=: \n\t"
28352835
"VSTM %[over], {q0-q3} \n\t"
28362836
/* XOR 32 bytes */
28372837
"CMP %[bytes], #32 \n\t"
2838-
"B.LT L_chacha20_arm32_64_lt_32_%= \n\t"
2838+
"BLT L_chacha20_arm32_64_lt_32_%= \n\t"
28392839
"VLD1.8 { q4, q5 }, [%[m]]! \n\t"
28402840
"VEOR q4, q4, q0 \n\t"
28412841
"VEOR q5, q5, q1 \n\t"
28422842
"VST1.8 { q4, q5 }, [%[c]]! \n\t"
28432843
"SUBS %[bytes], %[bytes], #32 \n\t"
28442844
"VMOV q0, q2 \n\t"
28452845
"VMOV q1, q3 \n\t"
2846-
"B.EQ L_chacha20_arm32_64_done_%= \n\t"
2846+
"BEQ L_chacha20_arm32_64_done_%= \n\t"
28472847
"\n"
28482848
"L_chacha20_arm32_64_lt_32_%=: \n\t"
28492849
/* XOR 16 bytes */
28502850
"CMP %[bytes], #16 \n\t"
2851-
"B.LT L_chacha20_arm32_64_lt_16_%= \n\t"
2851+
"BLT L_chacha20_arm32_64_lt_16_%= \n\t"
28522852
"VLD1.8 { q4 }, [%[m]]! \n\t"
28532853
"VEOR q4, q4, q0 \n\t"
28542854
"VST1.8 { q4 }, [%[c]]! \n\t"
28552855
"SUBS %[bytes], %[bytes], #16 \n\t"
28562856
"VMOV q0, q1 \n\t"
2857-
"B.EQ L_chacha20_arm32_64_done_%= \n\t"
2857+
"BEQ L_chacha20_arm32_64_done_%= \n\t"
28582858
"\n"
28592859
"L_chacha20_arm32_64_lt_16_%=: \n\t"
28602860
/* XOR 8 bytes */
28612861
"CMP %[bytes], #8 \n\t"
2862-
"B.LT L_chacha20_arm32_64_lt_8_%= \n\t"
2862+
"BLT L_chacha20_arm32_64_lt_8_%= \n\t"
28632863
"VLD1.8 { d8 }, [%[m]]! \n\t"
28642864
"VEOR d8, d8, d0 \n\t"
28652865
"VST1.8 { d8 }, [%[c]]! \n\t"
28662866
"SUBS %[bytes], %[bytes], #8 \n\t"
28672867
"VMOV d0, d1 \n\t"
2868-
"B.EQ L_chacha20_arm32_64_done_%= \n\t"
2868+
"BEQ L_chacha20_arm32_64_done_%= \n\t"
28692869
"\n"
28702870
"L_chacha20_arm32_64_lt_8_%=: \n\t"
28712871
/* XOR 4 bytes */
28722872
"CMP %[bytes], #4 \n\t"
2873-
"B.LT L_chacha20_arm32_64_lt_4_%= \n\t"
2873+
"BLT L_chacha20_arm32_64_lt_4_%= \n\t"
28742874
"LDR r12, [%[m]], #4 \n\t"
28752875
"VMOV r14, d0[0] \n\t"
28762876
"EOR r12, r12, r14 \n\t"
28772877
"STR r12, [%[c]], #4 \n\t"
28782878
"SUBS %[bytes], %[bytes], #4 \n\t"
28792879
"VSHR.U64 d0, d0, #32 \n\t"
2880-
"B.EQ L_chacha20_arm32_64_done_%= \n\t"
2880+
"BEQ L_chacha20_arm32_64_done_%= \n\t"
28812881
"\n"
28822882
"L_chacha20_arm32_64_lt_4_%=: \n\t"
28832883
/* XOR remaining bytes */
@@ -2889,7 +2889,7 @@ static WC_INLINE void wc_Chacha_encrypt_64(const word32* input, const byte* m,
28892889
"STRB r12, [%[c]], #1 \n\t"
28902890
"SUBS %[bytes], %[bytes], #1 \n\t"
28912891
"LSR r14, r14, #8 \n\t"
2892-
"B.GT L_chacha20_arm32_64_lt_4_loop_%= \n\t"
2892+
"BGT L_chacha20_arm32_64_lt_4_loop_%= \n\t"
28932893
"\n"
28942894
"L_chacha20_arm32_64_done_%=: \n\t"
28952895
: [input] "+r" (input), [m] "+r" (m), [c] "+r" (c), [bytes] "+r" (bytes)

0 commit comments

Comments
 (0)