llvm-project/llvm/test/CodeGen/AVR/icall-func-pointer-correct-addr-space.ll
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
834 B
LLVM

; RUN: llc -mattr=lpm,lpmw < %s -mtriple=avr | FileCheck %s
@callbackPtr = common global ptr addrspace(1) null, align 8
@myValuePtr = common global ptr null, align 8
@externalConstant = external global i16, align 2
declare void @externalFunction(i16 signext)
declare void @bar(i8 signext, ptr, ptr)
; CHECK-LABEL: loadCallbackPtr
define void @loadCallbackPtr() {
entry:
; CHECK: ldi r{{[0-9]+}}, pm_lo8(externalFunction)
; CHECK-NEXT: ldi r{{[0-9]+}}, pm_hi8(externalFunction)
store ptr addrspace(1) @externalFunction, ptr @callbackPtr, align 8
ret void
}
; CHECK-LABEL: loadValuePtr
define void @loadValuePtr() {
entry:
; CHECK: ldi r{{[0-9]+}}, lo8(externalConstant)
; CHECK-NEXT: ldi r{{[0-9]+}}, hi8(externalConstant)
store ptr @externalConstant, ptr @myValuePtr, align 8
ret void
}