Files
clang-p2996/llvm/test/CodeGen/AVR/pseudo/NEGWRd.mir
Ayke van Laethem 5527b21516 [AVR] Do not use R0/R1 on avrtiny
This patch makes sure the compiler uses R16/R17 on avrtiny (attiny10
etc) instead of R0/R1.

Some notes:

  * For the NEGW and ROLB instructions, it adds an explicit zero
    register. This is necessary because the zero register is different
    on avrtiny (and InstrInfo Uses lines need a fixed register).
  * Not entirely sure about putting all tests in features/avr-tiny.ll,
    but it doesn't seem like the "target-cpu"="attiny10" attribute
    works.

Updates: https://github.com/llvm/llvm-project/issues/53459

Differential Revision: https://reviews.llvm.org/D138582
2022-11-28 18:05:55 +01:00

32 lines
859 B
YAML

# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - | FileCheck %s
# This test checks the expansion of the 16-bit NEG pseudo instruction.
--- |
target triple = "avr--"
define void @test_negwrd() {
entry:
ret void
}
...
---
name: test_negwrd
body: |
bb.0.entry:
liveins: $r15r14
; CHECK-LABEL: test_negwrd
; CHECK: $r15 = NEGRd killed $r15, implicit-def dead $sreg
; CHECK-NEXT: $r14 = NEGRd $r14
; CHECK-NEXT: $r15 = SBCRdRr $r15, $r1, implicit-def $sreg, implicit killed $sreg
$r15r14 = NEGWRd $r15r14, $r1, implicit-def $sreg
; avrtiny variant
; CHECK: $r15 = NEGRd killed $r15, implicit-def dead $sreg
; CHECK-NEXT: $r14 = NEGRd $r14
; CHECK-NEXT: $r15 = SBCRdRr $r15, $r17, implicit-def $sreg, implicit killed $sreg
$r15r14 = NEGWRd $r15r14, $r17, implicit-def $sreg
...