Fangrui Song 9ef1d37ffb [AVR,test] Change llc -march= to -mtriple=
Similar to 806761a7629df268c8aed49657aeccffa6bca449

-mtriple= specifies the full target triple while -march= merely sets the
architecture part of the default target triple, leaving a target triple which
may not make sense.

Therefore, -march= is error-prone and not recommended for tests without a target
triple. The issue has been benign as we recognize avr-apple-darwin as ELF instead
of rejecting it outrightly.
2024-12-15 10:26:33 -08:00

28 lines
699 B
LLVM

; RUN: llc -mattr=avr6,sram < %s -mtriple=avr | FileCheck %s
; This file tests whether the compiler correctly works with the r1 register,
; clearing it when needed.
; Test regular use of r1 as a zero register.
; CHECK-LABEL: store8zero:
; CHECK: st {{[XYZ]}}, r1
; CHECK-NEXT: mov r24, r1
; CHECK-NEXT: ret
define i8 @store8zero(ptr %x) {
store i8 0, ptr %x
ret i8 0
}
; Test that mulitplication instructions (mul, muls, etc) clobber r1 and require
; a "clr r1" instruction.
; CHECK-LABEL: mul:
; CHECK: muls
; CHECK-NEXT: clr r1
; CHECK-NEXT: st {{[XYZ]}}, r0
; CHECK-NEXT: ret
define void @mul(ptr %ptr, i8 %n) {
%result = mul i8 %n, 3
store i8 %result, ptr %ptr
ret void
}