Skip to content

Commit d1bc75d

Browse files
xen0nchenhuacai
authored andcommitted
LoongArch: Simplify "BLT foo, zero" with BLTZ
Support for the syntactic sugar is present in upstream binutils port from the beginning. Use it for shorter lines and better consistency. Generated code should be identical. Signed-off-by: WANG Xuerui <git@xen0n.name> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent d47b2dc commit d1bc75d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

arch/loongarch/include/asm/atomic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static inline int arch_atomic_sub_if_positive(int i, atomic_t *v)
158158
"1: ll.w %1, %2 # atomic_sub_if_positive\n"
159159
" addi.w %0, %1, %3 \n"
160160
" move %1, %0 \n"
161-
" blt %0, $zero, 2f \n"
161+
" bltz %0, 2f \n"
162162
" sc.w %1, %2 \n"
163163
" beqz %1, 1b \n"
164164
"2: \n"
@@ -171,7 +171,7 @@ static inline int arch_atomic_sub_if_positive(int i, atomic_t *v)
171171
"1: ll.w %1, %2 # atomic_sub_if_positive\n"
172172
" sub.w %0, %1, %3 \n"
173173
" move %1, %0 \n"
174-
" blt %0, $zero, 2f \n"
174+
" bltz %0, 2f \n"
175175
" sc.w %1, %2 \n"
176176
" beqz %1, 1b \n"
177177
"2: \n"
@@ -321,7 +321,7 @@ static inline long arch_atomic64_sub_if_positive(long i, atomic64_t *v)
321321
"1: ll.d %1, %2 # atomic64_sub_if_positive \n"
322322
" addi.d %0, %1, %3 \n"
323323
" move %1, %0 \n"
324-
" blt %0, $zero, 2f \n"
324+
" bltz %0, 2f \n"
325325
" sc.d %1, %2 \n"
326326
" beqz %1, 1b \n"
327327
"2: \n"
@@ -334,7 +334,7 @@ static inline long arch_atomic64_sub_if_positive(long i, atomic64_t *v)
334334
"1: ll.d %1, %2 # atomic64_sub_if_positive \n"
335335
" sub.d %0, %1, %3 \n"
336336
" move %1, %0 \n"
337-
" blt %0, $zero, 2f \n"
337+
" bltz %0, 2f \n"
338338
" sc.d %1, %2 \n"
339339
" beqz %1, 1b \n"
340340
"2: \n"

arch/loongarch/mm/tlbex.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ SYM_FUNC_START(handle_tlb_load)
4747
* The vmalloc handling is not in the hotpath.
4848
*/
4949
csrrd t0, LOONGARCH_CSR_BADV
50-
blt t0, zero, vmalloc_load
50+
bltz t0, vmalloc_load
5151
csrrd t1, LOONGARCH_CSR_PGDL
5252

5353
vmalloc_done_load:
@@ -210,7 +210,7 @@ SYM_FUNC_START(handle_tlb_store)
210210
* The vmalloc handling is not in the hotpath.
211211
*/
212212
csrrd t0, LOONGARCH_CSR_BADV
213-
blt t0, zero, vmalloc_store
213+
bltz t0, vmalloc_store
214214
csrrd t1, LOONGARCH_CSR_PGDL
215215

216216
vmalloc_done_store:
@@ -378,7 +378,7 @@ SYM_FUNC_START(handle_tlb_modify)
378378
* The vmalloc handling is not in the hotpath.
379379
*/
380380
csrrd t0, LOONGARCH_CSR_BADV
381-
blt t0, zero, vmalloc_modify
381+
bltz t0, vmalloc_modify
382382
csrrd t1, LOONGARCH_CSR_PGDL
383383

384384
vmalloc_done_modify:

0 commit comments

Comments
 (0)