1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s --check-prefix=RV32I
4 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
5 ; RUN: | FileCheck %s --check-prefix=RV64I
7 define void @cast0(ptr addrspace(1) %ptr) {
10 ; RV32I-NEXT: sw zero, 0(a0)
15 ; RV64I-NEXT: sw zero, 0(a0)
17 %ptr0 = addrspacecast ptr addrspace(1) %ptr to ptr addrspace(0)
18 store i32 0, ptr %ptr0
22 define void @cast1(ptr %ptr) {
25 ; RV32I-NEXT: addi sp, sp, -16
26 ; RV32I-NEXT: .cfi_def_cfa_offset 16
27 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
28 ; RV32I-NEXT: .cfi_offset ra, -4
29 ; RV32I-NEXT: call foo
30 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
31 ; RV32I-NEXT: .cfi_restore ra
32 ; RV32I-NEXT: addi sp, sp, 16
33 ; RV32I-NEXT: .cfi_def_cfa_offset 0
38 ; RV64I-NEXT: addi sp, sp, -16
39 ; RV64I-NEXT: .cfi_def_cfa_offset 16
40 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
41 ; RV64I-NEXT: .cfi_offset ra, -8
42 ; RV64I-NEXT: call foo
43 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
44 ; RV64I-NEXT: .cfi_restore ra
45 ; RV64I-NEXT: addi sp, sp, 16
46 ; RV64I-NEXT: .cfi_def_cfa_offset 0
48 %castptr = addrspacecast ptr %ptr to ptr addrspace(10)
49 call void @foo(ptr addrspace(10) %castptr)
53 declare void @foo(ptr addrspace(10))