Skip to content

Commit 1687476

Browse files
committed
SP Cortex-M: branch long explicitly for IAR
GCC doesn't like explicit wide branch instruction but will use appropriate instruction implicitly. IAR won't widen branch instruction unless explicitly told.
1 parent 1a3f3aa commit 1687476

1 file changed

Lines changed: 40 additions & 40 deletions

File tree

wolfcrypt/src/sp_cortexm.c

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3707,10 +3707,10 @@ static void sp_2048_mont_reduce_32(sp_digit* a, const sp_digit* m, sp_digit mp)
37073707
"ADD r11, r11, #0x4\n\t"
37083708
"ADD %[a], %[a], #0x4\n\t"
37093709
"CMP r11, #0x80\n\t"
3710-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
3710+
#ifdef __GNUC__
37113711
"BLT L_sp_2048_mont_reduce_32_word_%=\n\t"
37123712
#else
3713-
"BLT.N L_sp_2048_mont_reduce_32_word_%=\n\t"
3713+
"BLT.W L_sp_2048_mont_reduce_32_word_%=\n\t"
37143714
#endif
37153715
/* Loop Done */
37163716
"STR r4, [%[a]]\n\t"
@@ -4027,10 +4027,10 @@ static void sp_2048_mont_reduce_32(sp_digit* a, const sp_digit* m, sp_digit mp)
40274027
"ADD r4, r4, #0x4\n\t"
40284028
"ADD %[a], %[a], #0x4\n\t"
40294029
"CMP r4, #0x80\n\t"
4030-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
4030+
#ifdef __GNUC__
40314031
"BLT L_sp_2048_mont_reduce_32_word_%=\n\t"
40324032
#else
4033-
"BLT.N L_sp_2048_mont_reduce_32_word_%=\n\t"
4033+
"BLT.W L_sp_2048_mont_reduce_32_word_%=\n\t"
40344034
#endif
40354035
/* Loop Done */
40364036
"STR r6, [%[a]]\n\t"
@@ -6203,10 +6203,10 @@ static void sp_2048_mont_reduce_64(sp_digit* a, const sp_digit* m, sp_digit mp)
62036203
"ADD r11, r11, #0x4\n\t"
62046204
"ADD %[a], %[a], #0x4\n\t"
62056205
"CMP r11, #0x100\n\t"
6206-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
6206+
#ifdef __GNUC__
62076207
"BLT L_sp_2048_mont_reduce_64_word_%=\n\t"
62086208
#else
6209-
"BLT.N L_sp_2048_mont_reduce_64_word_%=\n\t"
6209+
"BLT.W L_sp_2048_mont_reduce_64_word_%=\n\t"
62106210
#endif
62116211
/* Loop Done */
62126212
"STR r4, [%[a]]\n\t"
@@ -6683,10 +6683,10 @@ static void sp_2048_mont_reduce_64(sp_digit* a, const sp_digit* m, sp_digit mp)
66836683
"ADD r4, r4, #0x4\n\t"
66846684
"ADD %[a], %[a], #0x4\n\t"
66856685
"CMP r4, #0x100\n\t"
6686-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
6686+
#ifdef __GNUC__
66876687
"BLT L_sp_2048_mont_reduce_64_word_%=\n\t"
66886688
#else
6689-
"BLT.N L_sp_2048_mont_reduce_64_word_%=\n\t"
6689+
"BLT.W L_sp_2048_mont_reduce_64_word_%=\n\t"
66906690
#endif
66916691
/* Loop Done */
66926692
"STR r6, [%[a]]\n\t"
@@ -14774,10 +14774,10 @@ static void sp_3072_mont_reduce_48(sp_digit* a, const sp_digit* m, sp_digit mp)
1477414774
"ADD r11, r11, #0x4\n\t"
1477514775
"ADD %[a], %[a], #0x4\n\t"
1477614776
"CMP r11, #0xc0\n\t"
14777-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
14777+
#ifdef __GNUC__
1477814778
"BLT L_sp_3072_mont_reduce_48_word_%=\n\t"
1477914779
#else
14780-
"BLT.N L_sp_3072_mont_reduce_48_word_%=\n\t"
14780+
"BLT.W L_sp_3072_mont_reduce_48_word_%=\n\t"
1478114781
#endif
1478214782
/* Loop Done */
1478314783
"STR r4, [%[a]]\n\t"
@@ -15174,10 +15174,10 @@ static void sp_3072_mont_reduce_48(sp_digit* a, const sp_digit* m, sp_digit mp)
1517415174
"ADD r4, r4, #0x4\n\t"
1517515175
"ADD %[a], %[a], #0x4\n\t"
1517615176
"CMP r4, #0xc0\n\t"
15177-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
15177+
#ifdef __GNUC__
1517815178
"BLT L_sp_3072_mont_reduce_48_word_%=\n\t"
1517915179
#else
15180-
"BLT.N L_sp_3072_mont_reduce_48_word_%=\n\t"
15180+
"BLT.W L_sp_3072_mont_reduce_48_word_%=\n\t"
1518115181
#endif
1518215182
/* Loop Done */
1518315183
"STR r6, [%[a]]\n\t"
@@ -17974,10 +17974,10 @@ static void sp_3072_mont_reduce_96(sp_digit* a, const sp_digit* m, sp_digit mp)
1797417974
"ADD r11, r11, #0x4\n\t"
1797517975
"ADD %[a], %[a], #0x4\n\t"
1797617976
"CMP r11, #0x180\n\t"
17977-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
17977+
#ifdef __GNUC__
1797817978
"BLT L_sp_3072_mont_reduce_96_word_%=\n\t"
1797917979
#else
17980-
"BLT.N L_sp_3072_mont_reduce_96_word_%=\n\t"
17980+
"BLT.W L_sp_3072_mont_reduce_96_word_%=\n\t"
1798117981
#endif
1798217982
/* Loop Done */
1798317983
"STR r4, [%[a]]\n\t"
@@ -18614,10 +18614,10 @@ static void sp_3072_mont_reduce_96(sp_digit* a, const sp_digit* m, sp_digit mp)
1861418614
"ADD r4, r4, #0x4\n\t"
1861518615
"ADD %[a], %[a], #0x4\n\t"
1861618616
"CMP r4, #0x180\n\t"
18617-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
18617+
#ifdef __GNUC__
1861818618
"BLT L_sp_3072_mont_reduce_96_word_%=\n\t"
1861918619
#else
18620-
"BLT.N L_sp_3072_mont_reduce_96_word_%=\n\t"
18620+
"BLT.W L_sp_3072_mont_reduce_96_word_%=\n\t"
1862118621
#endif
1862218622
/* Loop Done */
1862318623
"STR r6, [%[a]]\n\t"
@@ -25648,10 +25648,10 @@ static void sp_4096_mont_reduce_128(sp_digit* a, const sp_digit* m, sp_digit mp)
2564825648
"ADD r11, r11, #0x4\n\t"
2564925649
"ADD %[a], %[a], #0x4\n\t"
2565025650
"CMP r11, #0x200\n\t"
25651-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
25651+
#ifdef __GNUC__
2565225652
"BLT L_sp_4096_mont_reduce_128_word_%=\n\t"
2565325653
#else
25654-
"BLT.N L_sp_4096_mont_reduce_128_word_%=\n\t"
25654+
"BLT.W L_sp_4096_mont_reduce_128_word_%=\n\t"
2565525655
#endif
2565625656
/* Loop Done */
2565725657
"STR r4, [%[a]]\n\t"
@@ -26448,10 +26448,10 @@ static void sp_4096_mont_reduce_128(sp_digit* a, const sp_digit* m, sp_digit mp)
2644826448
"ADD r4, r4, #0x4\n\t"
2644926449
"ADD %[a], %[a], #0x4\n\t"
2645026450
"CMP r4, #0x200\n\t"
26451-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
26451+
#ifdef __GNUC__
2645226452
"BLT L_sp_4096_mont_reduce_128_word_%=\n\t"
2645326453
#else
26454-
"BLT.N L_sp_4096_mont_reduce_128_word_%=\n\t"
26454+
"BLT.W L_sp_4096_mont_reduce_128_word_%=\n\t"
2645526455
#endif
2645626456
/* Loop Done */
2645726457
"STR r6, [%[a]]\n\t"
@@ -34262,10 +34262,10 @@ static void sp_256_mont_reduce_8(sp_digit* a, const sp_digit* m, sp_digit mp)
3426234262
"ADD r11, r11, #0x4\n\t"
3426334263
"ADD %[a], %[a], #0x4\n\t"
3426434264
"CMP r11, #0x20\n\t"
34265-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
34265+
#ifdef __GNUC__
3426634266
"BLT L_sp_256_mont_reduce_8_word_%=\n\t"
3426734267
#else
34268-
"BLT.N L_sp_256_mont_reduce_8_word_%=\n\t"
34268+
"BLT.W L_sp_256_mont_reduce_8_word_%=\n\t"
3426934269
#endif
3427034270
/* Loop Done */
3427134271
"STR r4, [%[a]]\n\t"
@@ -34354,10 +34354,10 @@ static void sp_256_mont_reduce_8(sp_digit* a, const sp_digit* m, sp_digit mp)
3435434354
"ADD r4, r4, #0x4\n\t"
3435534355
"ADD %[a], %[a], #0x4\n\t"
3435634356
"CMP r4, #0x20\n\t"
34357-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
34357+
#ifdef __GNUC__
3435834358
"BLT L_sp_256_mont_reduce_8_word_%=\n\t"
3435934359
#else
34360-
"BLT.N L_sp_256_mont_reduce_8_word_%=\n\t"
34360+
"BLT.W L_sp_256_mont_reduce_8_word_%=\n\t"
3436134361
#endif
3436234362
/* Loop Done */
3436334363
"STR r6, [%[a]]\n\t"
@@ -34636,10 +34636,10 @@ static void sp_256_mont_reduce_order_8(sp_digit* a, const sp_digit* m, sp_digit
3463634636
"ADD r11, r11, #0x4\n\t"
3463734637
"ADD %[a], %[a], #0x4\n\t"
3463834638
"CMP r11, #0x20\n\t"
34639-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
34639+
#ifdef __GNUC__
3464034640
"BLT L_sp_256_mont_reduce_order_8_word_%=\n\t"
3464134641
#else
34642-
"BLT.N L_sp_256_mont_reduce_order_8_word_%=\n\t"
34642+
"BLT.W L_sp_256_mont_reduce_order_8_word_%=\n\t"
3464334643
#endif
3464434644
/* Loop Done */
3464534645
"STR r4, [%[a]]\n\t"
@@ -34728,10 +34728,10 @@ static void sp_256_mont_reduce_order_8(sp_digit* a, const sp_digit* m, sp_digit
3472834728
"ADD r4, r4, #0x4\n\t"
3472934729
"ADD %[a], %[a], #0x4\n\t"
3473034730
"CMP r4, #0x20\n\t"
34731-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
34731+
#ifdef __GNUC__
3473234732
"BLT L_sp_256_mont_reduce_order_8_word_%=\n\t"
3473334733
#else
34734-
"BLT.N L_sp_256_mont_reduce_order_8_word_%=\n\t"
34734+
"BLT.W L_sp_256_mont_reduce_order_8_word_%=\n\t"
3473534735
#endif
3473634736
/* Loop Done */
3473734737
"STR r6, [%[a]]\n\t"
@@ -44011,10 +44011,10 @@ static void sp_384_mont_reduce_12(sp_digit* a, const sp_digit* m, sp_digit mp)
4401144011
"ADD r11, r11, #0x4\n\t"
4401244012
"ADD %[a], %[a], #0x4\n\t"
4401344013
"CMP r11, #0x30\n\t"
44014-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
44014+
#ifdef __GNUC__
4401544015
"BLT L_sp_384_mont_reduce_12_word_%=\n\t"
4401644016
#else
44017-
"BLT.N L_sp_384_mont_reduce_12_word_%=\n\t"
44017+
"BLT.W L_sp_384_mont_reduce_12_word_%=\n\t"
4401844018
#endif
4401944019
/* Loop Done */
4402044020
"STR r4, [%[a]]\n\t"
@@ -44123,10 +44123,10 @@ static void sp_384_mont_reduce_12(sp_digit* a, const sp_digit* m, sp_digit mp)
4412344123
"ADD r4, r4, #0x4\n\t"
4412444124
"ADD %[a], %[a], #0x4\n\t"
4412544125
"CMP r4, #0x30\n\t"
44126-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
44126+
#ifdef __GNUC__
4412744127
"BLT L_sp_384_mont_reduce_12_word_%=\n\t"
4412844128
#else
44129-
"BLT.N L_sp_384_mont_reduce_12_word_%=\n\t"
44129+
"BLT.W L_sp_384_mont_reduce_12_word_%=\n\t"
4413044130
#endif
4413144131
/* Loop Done */
4413244132
"STR r6, [%[a]]\n\t"
@@ -55604,10 +55604,10 @@ static void sp_521_mont_reduce_order_17(sp_digit* a, const sp_digit* m, sp_digit
5560455604
"ADD r11, r11, #0x4\n\t"
5560555605
"ADD %[a], %[a], #0x4\n\t"
5560655606
"CMP r11, #0x44\n\t"
55607-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
55607+
#ifdef __GNUC__
5560855608
"BLT L_sp_521_mont_reduce_order_17_word_%=\n\t"
5560955609
#else
55610-
"BLT.N L_sp_521_mont_reduce_order_17_word_%=\n\t"
55610+
"BLT.W L_sp_521_mont_reduce_order_17_word_%=\n\t"
5561155611
#endif
5561255612
/* Loop Done */
5561355613
"STR r4, [%[a]]\n\t"
@@ -55822,10 +55822,10 @@ static void sp_521_mont_reduce_order_17(sp_digit* a, const sp_digit* m, sp_digit
5582255822
"ADD r4, r4, #0x4\n\t"
5582355823
"ADD %[a], %[a], #0x4\n\t"
5582455824
"CMP r4, #0x44\n\t"
55825-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
55825+
#ifdef __GNUC__
5582655826
"BLT L_sp_521_mont_reduce_order_17_word_%=\n\t"
5582755827
#else
55828-
"BLT.N L_sp_521_mont_reduce_order_17_word_%=\n\t"
55828+
"BLT.W L_sp_521_mont_reduce_order_17_word_%=\n\t"
5582955829
#endif
5583055830
/* Loop Done */
5583155831
"STR r6, [%[a]]\n\t"
@@ -69752,10 +69752,10 @@ static void sp_1024_mont_reduce_32(sp_digit* a, const sp_digit* m, sp_digit mp)
6975269752
"ADD r11, r11, #0x4\n\t"
6975369753
"ADD %[a], %[a], #0x4\n\t"
6975469754
"CMP r11, #0x80\n\t"
69755-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
69755+
#ifdef __GNUC__
6975669756
"BLT L_sp_1024_mont_reduce_32_word_%=\n\t"
6975769757
#else
69758-
"BLT.N L_sp_1024_mont_reduce_32_word_%=\n\t"
69758+
"BLT.W L_sp_1024_mont_reduce_32_word_%=\n\t"
6975969759
#endif
6976069760
/* Loop Done */
6976169761
"STR r4, [%[a]]\n\t"
@@ -69969,10 +69969,10 @@ static void sp_1024_mont_reduce_32(sp_digit* a, const sp_digit* m, sp_digit mp)
6996969969
"ADD r4, r4, #0x4\n\t"
6997069970
"ADD %[a], %[a], #0x4\n\t"
6997169971
"CMP r4, #0x80\n\t"
69972-
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
69972+
#ifdef __GNUC__
6997369973
"BLT L_sp_1024_mont_reduce_32_word_%=\n\t"
6997469974
#else
69975-
"BLT.N L_sp_1024_mont_reduce_32_word_%=\n\t"
69975+
"BLT.W L_sp_1024_mont_reduce_32_word_%=\n\t"
6997669976
#endif
6997769977
/* Loop Done */
6997869978
"STR r6, [%[a]]\n\t"

0 commit comments

Comments
 (0)