Skip to content

Commit

Permalink
[AVR] Add tests for a large number of pseudo instructions
Browse files Browse the repository at this point in the history
This adds MIR tests for 24 pseudo instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289191 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Dylan McKay committed Dec 9, 2016
1 parent b2d19fd commit 153fa86
Show file tree
Hide file tree
Showing 28 changed files with 572 additions and 4 deletions.
12 changes: 12 additions & 0 deletions lib/Target/AVR/AVRExpandPseudoInsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,16 @@ bool AVRExpandPseudo::expand<AVR::LDDWRdPtrQ>(Block &MBB, BlockIt MBBI) {
return true;
}

template <>
bool AVRExpandPseudo::expand<AVR::LPMWRdZ>(Block &MBB, BlockIt MBBI) {
llvm_unreachable("wide LPM is unimplemented");
}

template <>
bool AVRExpandPseudo::expand<AVR::LPMWRdZPi>(Block &MBB, BlockIt MBBI) {
llvm_unreachable("wide LPMPi is unimplemented");
}

template<typename Func>
bool AVRExpandPseudo::expandAtomic(Block &MBB, BlockIt MBBI, Func f) {
// Remove the pseudo instruction.
Expand Down Expand Up @@ -1415,6 +1425,8 @@ bool AVRExpandPseudo::expandMI(Block &MBB, BlockIt MBBI) {
EXPAND(AVR::LDWRdPtrPd);
case AVR::LDDWRdYQ: //:FIXME: remove this once PR13375 gets fixed
EXPAND(AVR::LDDWRdPtrQ);
EXPAND(AVR::LPMWRdZ);
EXPAND(AVR::LPMWRdZPi);
EXPAND(AVR::AtomicLoad8);
EXPAND(AVR::AtomicLoad16);
EXPAND(AVR::AtomicStore8);
Expand Down
3 changes: 3 additions & 0 deletions test/CodeGen/AVR/progmem-extended.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
; RUN: llc < %s -march=avr -mattr=movw,lpmx | FileCheck %s
; XFAIL: *

# Wide LPM is currently unimplemented in the pseudo expansion pass.

; Tests the extended LPM instructions (LPMW, LPM Rd, Z+).

Expand Down
22 changes: 22 additions & 0 deletions test/CodeGen/AVR/pseudo/ASRWRd.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

--- |
target triple = "avr--"
define void @test() {
entry:
ret void
}
...

---
name: test
body: |
bb.0.entry:
; CHECK-LABEL: test
; CHECK: %r15 = ASRRd %r15, implicit-def %sreg
; CHECK-NEXT: %r14 = RORRd %r14, implicit-def %sreg, implicit killed %sreg
%r15r14 = ASRWRd %r15r14, implicit-def %sreg
...
6 changes: 4 additions & 2 deletions test/CodeGen/AVR/pseudo/CPCWRdRr.mir
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s
# XFAIL: *

# This test checks the expansion of the 16-bit CPCW pseudo instruction.

Expand All @@ -18,5 +17,8 @@ body: |
; CHECK-LABEL: test_cpcwrdrr
%r15r14 = CPCWRdRr %r15r14, %r21r20, implicit-def %sreg, implicit %sreg
; CHECK: CPCRdRr %r20, %r22, implicit-def %sreg, implicit killed %sreg
; CHECK-NEXT: CPCRdRr %r21, %r23, implicit-def %sreg, implicit killed %sreg
CPCWRdRr %r21r20, %r23r22, implicit-def %sreg, implicit %sreg
...
6 changes: 4 additions & 2 deletions test/CodeGen/AVR/pseudo/CPWRdRr.mir
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s
# XFAIL: *

# This test checks the expansion of the 16-bit CPW pseudo instruction.

Expand All @@ -18,5 +17,8 @@ body: |
; CHECK-LABEL: test_cpwrdrr
%r15r14 = CPWRdRr %r15r14, %r21r20, implicit-def %sreg
; CHECK: CPRdRr %r14, %r20, implicit-def %sreg
; CHECK-NEXT: CPCRdRr %r15, %r21, implicit-def %sreg, implicit killed %sreg
CPWRdRr %r15r14, %r21r20, implicit-def %sreg
...
25 changes: 25 additions & 0 deletions test/CodeGen/AVR/pseudo/FRMIDX.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

# TODO: Write this test.
# This instruction isn't expanded by the pseudo expansion passs, but
# rather AVRRegisterInfo::eliminateFrameIndex.

--- |
target triple = "avr--"
define void @test() {
entry:
ret void
}
...

---
name: test
registers:
- { id: 0, class: _ }
body: |
bb.0.entry:
; CHECK-LABEL: test
%r29r28 = FRMIDX %r31r30, 0, implicit-def %sreg
...
22 changes: 22 additions & 0 deletions test/CodeGen/AVR/pseudo/INWRdA.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

--- |
target triple = "avr--"
define void @test() {
entry:
ret void
}
...

---
name: test
body: |
bb.0.entry:
; CHECK-LABEL: test
; CHECK: %r14 = INRdA 31
; CHECK-NEXT: %r15 = INRdA 32
%r15r14 = INWRdA 31
...
24 changes: 24 additions & 0 deletions test/CodeGen/AVR/pseudo/LDIWRdK.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

# This test checks the expansion of the 16-bit LDIWRdK pseudo instruction.

--- |
target triple = "avr--"
define void @test_ldiwrdrr() {
entry:
ret void
}
...

---
name: test_ldiwrdrr
body: |
bb.0.entry:
; CHECK-LABEL: test_ldiwrdrr
; CHECK: %r30 = LDIRdK 255
; CHECK-NEXT: %r31 = LDIRdK 9
%r31r30 = LDIWRdK 2559
...
24 changes: 24 additions & 0 deletions test/CodeGen/AVR/pseudo/LDSWRdK.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

# This test checks the expansion of the 16-bit LDSWRdK pseudo instruction.

--- |
target triple = "avr--"
define void @test_ldswrdrr() {
entry:
ret void
}
...

---
name: test_ldswrdrr
body: |
bb.0.entry:
; CHECK-LABEL: test_ldswrdrr
; CHECK: %r30 = LDSRdK 2559
; CHECK-NEXT: %r31 = LDSRdK 2560
%r31r30 = LDSWRdK 2559
...
24 changes: 24 additions & 0 deletions test/CodeGen/AVR/pseudo/LDWRdPtr.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

# This test checks the expansion of the 16-bit LDWRdPtr pseudo instruction.

--- |
target triple = "avr--"
define void @test_ldwrdptr() {
entry:
ret void
}
...

---
name: test_ldwrdptr
body: |
bb.0.entry:
; CHECK-LABEL: test_ldwrdptr
; CHECK: %r0 = LDRdPtr %r31r30
; CHECK-NEXT: early-clobber %r1 = LDDRdPtrQ %r31r30, 1
%r1r0 = LDWRdPtr %r31r30
...
24 changes: 24 additions & 0 deletions test/CodeGen/AVR/pseudo/LDWRdPtrPd.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

# This test checks the expansion of the 16-bit LDWRdPtrPd pseudo instruction.

--- |
target triple = "avr--"
define void @test_ldwrdptrpd() {
entry:
ret void
}
...

---
name: test_ldwrdptrpd
body: |
bb.0.entry:
; CHECK-LABEL: test_ldwrdptrpd
; CHECK: early-clobber %r1, early-clobber %r31r30 = LDRdPtrPd killed %r31r30
; CHECK-NEXT: early-clobber %r0, early-clobber %r31r30 = LDRdPtrPd killed %r31r30
%r1r0, %r31r30 = LDWRdPtrPd %r31r30
...
24 changes: 24 additions & 0 deletions test/CodeGen/AVR/pseudo/LDWRdPtrPi.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

# This test checks the expansion of the 16-bit LDWRdPtrPi pseudo instruction.

--- |
target triple = "avr--"
define void @test_ldwrdptrpi() {
entry:
ret void
}
...

---
name: test_ldwrdptrpi
body: |
bb.0.entry:
; CHECK-LABEL: test_ldwrdptrpi
; CHECK: early-clobber %r0, early-clobber %r31r30 = LDRdPtrPi killed %r31r30
; CHECK-NEXT: early-clobber %r1, early-clobber %r31r30 = LDRdPtrPi killed %r31r30
%r1r0, %r31r30 = LDWRdPtrPi %r31r30
...
22 changes: 22 additions & 0 deletions test/CodeGen/AVR/pseudo/LPMWRdZ.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s
# XFAIL: *

# This instruction is currently unimplemented.

--- |
target triple = "avr--"
define void @test() {
entry:
ret void
}
...

---
name: test
body: |
bb.0.entry:
; CHECK-LABEL: test
%r5r4 = LPMWRdZ %r31r30
...
22 changes: 22 additions & 0 deletions test/CodeGen/AVR/pseudo/LPMWRdZPi.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s
# XFAIL: *

# This instruction is currently unimplemented.

--- |
target triple = "avr--"
define void @test() {
entry:
ret void
}
...

---
name: test
body: |
bb.0.entry:
; CHECK-LABEL: test
%r5r4 = LPMWRdZPi %r31r30, implicit-def %r31r30
...
22 changes: 22 additions & 0 deletions test/CodeGen/AVR/pseudo/LSLWRd.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

--- |
target triple = "avr--"
define void @test() {
entry:
ret void
}
...

---
name: test
body: |
bb.0.entry:
; CHECK-LABEL: test
; CHECK: %r14 = LSLRd %r14, implicit-def %sreg
; CHECK-NEXT: %r15 = ROLRd %r15, implicit-def %sreg, implicit killed %sreg
%r15r14 = LSLWRd %r15r14, implicit-def %sreg
...
22 changes: 22 additions & 0 deletions test/CodeGen/AVR/pseudo/LSRWRd.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

--- |
target triple = "avr--"
define void @test() {
entry:
ret void
}
...

---
name: test
body: |
bb.0.entry:
; CHECK-LABEL: test
; CHECK: %r15 = LSRRd %r15, implicit-def %sreg
; CHECK-NEXT: %r14 = RORRd %r14, implicit-def %sreg, implicit killed %sreg
%r15r14 = LSRWRd %r15r14, implicit-def %sreg
...
22 changes: 22 additions & 0 deletions test/CodeGen/AVR/pseudo/OUTWARr.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - 2>&1 | FileCheck %s

--- |
target triple = "avr--"
define void @test() {
entry:
ret void
}
...

---
name: test
body: |
bb.0.entry:
; CHECK-LABEL: test
; CHECK: OUTARr 32, %r15
; CHECK-NEXT: OUTARr 31, %r14
OUTWARr 31, %r15r14
...
Loading

0 comments on commit 153fa86

Please sign in to comment.