xref: /llvm-project/llvm/test/CodeGen/AVR/pseudo/LPMBRdZ.mir (revision 2a6e39dbf84af4b3f8b31930fed786b3c56287f5)
1# RUN: llc -mtriple=avr -mattr=+lpm -mattr=+lpmx -start-before=greedy %s -o - \
2# RUN:     | FileCheck %s
3# RUN: llc -mtriple=avr -mattr=+lpm -mattr=-lpmx -start-before=greedy %s -o - \
4# RUN:     | FileCheck --check-prefix=NOX %s
5
6# This test checks the expansion of the 8-bit LPMBRdZ pseudo instruction and that
7# the register allocator won't use R31R30 as an output register (which would
8# lead to undefined behavior).
9
10--- |
11  target triple = "avr--"
12  define void @test_lpmbrdz() {
13  entry:
14    ret void
15  }
16...
17
18---
19name:            test_lpmbrdz
20tracksRegLiveness: true
21body: |
22  bb.0.entry:
23    liveins: $r31r30
24
25    ; CHECK-LABEL: test_lpmbrdz:
26    ; CHECK:       ; %bb.0:
27    ; CHECK-NEXT:    lpm r30, Z
28    ; CHECK-NEXT:    ret
29
30    ; NOX-LABEL:   test_lpmbrdz
31    ; NOX:         ; %bb.0:
32    ; NOX-NEXT:      lpm
33    ; NOX-NEXT:      mov r30, r0
34    ; NOX-NEXT:      ret
35
36    %1:zreg = COPY killed $r31r30
37    %2:gpr8 = LPMBRdZ %1, implicit-def dead $r0
38    $r30 = COPY %2
39    RET implicit $r30
40...
41