Skip to content

Commit 7e8b232

Browse files
committed
[LoongArch][NFC] Improve csrxchg instrinsic test case
Took xry's idea [^1] to improve the csrxchg instrinsic test case. [^1]: llvm#141037 (comment)
1 parent 491619a commit 7e8b232

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/test/CodeGen/LoongArch/csrxchg-intrinsic.ll

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ entry:
1313
}
1414

1515
;; Check that the rj operand of csrxchg is not R1.
16-
define i32 @csrxchg_w_rj_not_r1() {
16+
define i32 @csrxchg_w_rj_not_r1(i32 %0) {
1717
; CHECK-NOT: csrxchg ${{[a-z]*}}, $r1, 0
1818
; CHECK-NOT: csrxchg ${{[a-z]*}}, $ra, 0
1919
entry:
20-
%0 = tail call i32 asm "", "=r,r,i,{r4},{r5},{r6},{r7},{r8},{r9},{r10},{r11},{r12},{r13},{r14},{r15},{r16},{r17},{r18},{r19},{r20},{r23},{r24},{r25},{r26},{r27},{r28},{r29},{r30},{r31},0"(i32 4, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
21-
%1 = tail call i32 @llvm.loongarch.csrxchg.w(i32 %0, i32 4, i32 0)
22-
%2 = tail call i32 asm "", "=r,r,i,{r4},{r5},{r6},{r7},{r8},{r9},{r10},{r11},{r12},{r13},{r14},{r15},{r16},{r17},{r18},{r19},{r20},{r23},{r24},{r25},{r26},{r27},{r28},{r29},{r30},{r31},0"(i32 4, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 %1)
23-
ret i32 %2
20+
%2 = tail call i32 asm "", "={$r1},{$r1}"(i32 0)
21+
%3 = tail call i32 @llvm.loongarch.csrxchg.w(i32 %0, i32 %2, i32 0)
22+
ret i32 %3
2423
}

0 commit comments

Comments
 (0)