Skip to content

Commit 695914e

Browse files
committed
SP Maths: PowerPC ASM fix
The instruction 'li' is a pseduo instruction for 'load immediate'. With some compilers, the immediate was interpretted R0[0]. Change to use XOR instead.
1 parent e814d1b commit 695914e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

wolfcrypt/src/sp_int.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3942,7 +3942,7 @@ static WC_INLINE sp_int_digit sp_div_word(sp_int_digit hi, sp_int_digit lo,
39423942
__asm__ __volatile__ ( \
39433943
"mulhwu %[h], %[a], %[b] \n\t" \
39443944
"mullw %[l], %[a], %[b] \n\t" \
3945-
"li %[o], 0 \n\t" \
3945+
"xor %[o], %[o], %[o] \n\t" \
39463946
: [l] "+r" (vl), [h] "+r" (vh), [o] "=r" (vo) \
39473947
: [a] "r" (va), [b] "r" (vb) \
39483948
)
@@ -4045,7 +4045,7 @@ static WC_INLINE sp_int_digit sp_div_word(sp_int_digit hi, sp_int_digit lo,
40454045
#define SP_ASM_SUBB(vl, vh, va) \
40464046
__asm__ __volatile__ ( \
40474047
"subfc %[l], %[a], %[l] \n\t" \
4048-
"li 16, 0 \n\t" \
4048+
"xor 16, 16, 16 \n\t" \
40494049
"subfe %[h], 16, %[h] \n\t" \
40504050
: [l] "+r" (vl), [h] "+r" (vh) \
40514051
: [a] "r" (va) \

0 commit comments

Comments
 (0)