Patryk Wychowaniec 5650688e72 [AVR] Fix expanding MOVW for overlapping registers
When expanding a MOVW (16-bit copy) to two MOVs (8-bit copy), the
lower byte always comes first. This is incorrect for corner cases like
'$r24r23 -> $r25r24', in which the higher byte copy should come first.

Current patch fixes that bug as recorded at
https://github.com/rust-lang/rust/issues/98167

Reviewed By: benshi001

Differential Revision: https://reviews.llvm.org/D128588
2022-06-26 17:20:07 +08:00

48 lines
781 B
YAML

# RUN: llc -O0 %s -o - | FileCheck %s
--- |
target triple = "avr--"
define void @test_copy_nonoverlapping() {
entry:
ret void
}
define void @test_copy_overlapping() {
entry:
ret void
}
declare void @foo(i16 %0)
...
---
name: test_copy_nonoverlapping
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $r25r24
; CHECK-LABEL: test_copy_nonoverlapping:
; CHECK: mov r22, r24
; CHECK-NEXT: mov r23, r25
$r23r22 = COPY $r25r24
RCALLk @foo, implicit $r24r23
...
---
name: test_copy_overlapping
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $r24r23
; CHECK-LABEL: test_copy_overlapping:
; CHECK: mov r25, r24
; CHECK-NEXT: mov r24, r23
$r25r24 = COPY $r24r23
RCALLk @foo, implicit $r25r24
...