diff options
Diffstat (limited to 'llvm/test/CodeGen/BPF/addr-space-cast.ll')
-rw-r--r-- | llvm/test/CodeGen/BPF/addr-space-cast.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/BPF/addr-space-cast.ll b/llvm/test/CodeGen/BPF/addr-space-cast.ll new file mode 100644 index 0000000..ad2860d --- /dev/null +++ b/llvm/test/CodeGen/BPF/addr-space-cast.ll @@ -0,0 +1,22 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc -march=bpfel -mcpu=v4 -filetype=asm -show-mc-encoding < %s | FileCheck %s + +define ptr addrspace(1) @foo(ptr %p) { +; CHECK-LABEL: foo: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: r0 = addr_space_cast(r1, 1, 0) # encoding: [0xbf,0x10,0x01,0x00,0x00,0x00,0x01,0x00] +; CHECK-NEXT: exit # encoding: [0x95,0x00,0x00,0x00,0x00,0x00,0x00,0x00] +entry: + %0 = addrspacecast ptr %p to ptr addrspace(1) + ret ptr addrspace(1) %0 +} + +define ptr @bar(ptr addrspace(1) %p) { +; CHECK-LABEL: bar: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: r0 = addr_space_cast(r1, 0, 1) # encoding: [0xbf,0x10,0x01,0x00,0x01,0x00,0x00,0x00] +; CHECK-NEXT: exit # encoding: [0x95,0x00,0x00,0x00,0x00,0x00,0x00,0x00] +entry: + %0 = addrspacecast ptr addrspace(1) %p to ptr + ret ptr %0 +} |