Skip to content

Commit 5c70902

Browse files
committed
Address xen0n's comments
1 parent 1148711 commit 5c70902

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
; RUN: llc --mtriple=loongarch32 --mattr=+f --verify-machineinstrs < %s | FileCheck %s
2+
; RUN: llc --mtriple=loongarch64 --mattr=+f --verify-machineinstrs < %s | FileCheck %s
3+
4+
;; Check that the "q" operand is not R0.
5+
define i32 @constraint_q_not_r0(i32 %a) {
6+
; CHECK-NOT: csrxchg ${{[a-z]*}}, $r0, 0
7+
; CHECK-NOT: csrxchg ${{[a-z]*}}, $zero, 0
8+
entry:
9+
%1 = tail call i32 asm "csrxchg $0, $1, $2", "=r,q,i,0"(i32 0, i32 0, i32 %a)
10+
ret i32 %1
11+
}
12+
13+
;; Check that the "q" operand is not R1.
14+
define i32 @constraint_q_not_r1() {
15+
; CHECK-NOT: csrxchg ${{[a-z]*}}, $r1, 0
16+
; CHECK-NOT: csrxchg ${{[a-z]*}}, $ra, 0
17+
entry:
18+
%0 = tail call i32 asm "csrxchg $0, $1, $2", "=r,q,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)
19+
ret i32 %0
20+
}

llvm/test/CodeGen/LoongArch/inline-asm-constraint.ll

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ define i32 @constraint_r(i32 %a, i32 %b) nounwind {
1717
ret i32 %1
1818
}
1919

20-
define i32 @constraint_q(i32 %a) nounwind {
21-
; CHECK-LABEL: constraint_q:
22-
; CHECK: # %bb.0:
23-
; CHECK-NEXT: move $a1, $zero
24-
; CHECK-NEXT: #APP
25-
; CHECK-NEXT: csrxchg $a0, $a1, 0
26-
; CHECK-NEXT: #NO_APP
27-
; CHECK-NEXT: ret
28-
%1 = tail call i32 asm "csrxchg $0, $1, $2", "=r,q,i,0"(i32 0, i32 0, i32 %a)
29-
ret i32 %1
30-
}
31-
3220
define i32 @constraint_i(i32 %a) nounwind {
3321
; CHECK-LABEL: constraint_i:
3422
; CHECK: # %bb.0:

0 commit comments

Comments
 (0)