Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Commit 4ba1f0a

Browse files
author
Dylan McKay
committed
[AVR] Fix atomic stores bug
In ISel, we allowed any register of [X,Y,Z]. We expanded to an instruction which required one of [Y, Z]. This would sometimes fail if X was allocated and used in the sequence.
1 parent 5f12f20 commit 4ba1f0a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/Target/AVR/AVRInstrInfo.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ class AtomicLoad<PatFrag Op, RegisterClass DRC> :
12421242
[(set DRC:$rd, (Op i16:$rr))]>;
12431243

12441244
class AtomicStore<PatFrag Op, RegisterClass DRC> :
1245-
Pseudo<(outs), (ins LDSTPtrReg:$rd, DRC:$rr), "atomic_op",
1245+
Pseudo<(outs), (ins PTRDISPREGS:$rd, DRC:$rr), "atomic_op",
12461246
[(Op i16:$rd, DRC:$rr)]>;
12471247

12481248
class AtomicLoadOp<PatFrag Op, RegisterClass DRC> :

test/CodeGen/AVR/atomics/store16.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,15 @@ define void @atomic_store16(i16* %foo) {
1111
ret void
1212
}
1313

14+
; CHECK-LABEL: monotonic
15+
; CHECK: in r0, 63
16+
; CHECK-NEXT: cli
17+
; CHECK-NEXT: st Z, r24
18+
; CHECK-NEXT: std Z+1, r25
19+
; CHECK-NEXT: out 63, r0
20+
define void @monotonic(i16) {
21+
entry-block:
22+
store atomic i16 %0, i16* undef monotonic, align 2
23+
ret void
24+
}
25+

0 commit comments

Comments
 (0)