1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=avr | FileCheck %s
4 @global = external global i8
5 @progmem = external addrspace(1) global i8
7 declare void @func() addrspace(1)
8 declare void @doCallback(ptr) addrspace(1)
10 define ptr @casttodata(ptr addrspace(1) %funcptr) addrspace(1) {
11 ; CHECK-LABEL: casttodata:
14 %result = addrspacecast ptr addrspace(1) %funcptr to ptr
18 define ptr addrspace(1) @casttofuncptr(ptr %data) addrspace(1) {
19 ; CHECK-LABEL: casttofuncptr:
22 %result = addrspacecast ptr %data to ptr addrspace(1)
23 ret ptr addrspace(1) %result
26 define ptr addrspace(1) @castglobal() addrspace(1) {
27 ; CHECK-LABEL: castglobal:
29 ; CHECK-NEXT: ldi r24, lo8(global)
30 ; CHECK-NEXT: ldi r25, hi8(global)
32 %result = addrspacecast ptr @global to ptr addrspace(1)
33 ret ptr addrspace(1) %result
36 define ptr @castprogmem() addrspace(1) {
37 ; CHECK-LABEL: castprogmem:
39 ; CHECK-NEXT: ldi r24, lo8(progmem)
40 ; CHECK-NEXT: ldi r25, hi8(progmem)
42 %result = addrspacecast ptr addrspace(1) @progmem to ptr
46 define ptr @castfunc() addrspace(1) {
47 ; CHECK-LABEL: castfunc:
49 ; CHECK-NEXT: ldi r24, pm_lo8(func)
50 ; CHECK-NEXT: ldi r25, pm_hi8(func)
52 %result = addrspacecast ptr addrspace(1) @func to ptr
56 define void @callCallback() addrspace(1) {
57 ; CHECK-LABEL: callCallback:
59 ; CHECK-NEXT: ldi r24, pm_lo8(func)
60 ; CHECK-NEXT: ldi r25, pm_hi8(func)
61 ; CHECK-NEXT: rcall doCallback
63 call addrspace(1) void @doCallback(ptr addrspacecast (ptr addrspace(1) @func to ptr))