Home | History | Annotate | Download | only in R600
      1 ; RUN: llc < %s -march=r600 -mcpu=SI -show-mc-encoding -verify-machineinstrs | FileCheck %s
      2 
      3 ;;;==========================================================================;;;
      4 ;;; MUBUF LOAD TESTS
      5 ;;;==========================================================================;;;
      6 
      7 ; MUBUF load with an immediate byte offset that fits into 12-bits
      8 ; CHECK-LABEL: @mubuf_load0
      9 ; CHECK: BUFFER_LOAD_DWORD v{{[0-9]}}, s[{{[0-9]:[0-9]}}] + v[{{[0-9]:[0-9]}}] + 0x4 ; encoding: [0x04,0x80
     10 define void @mubuf_load0(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
     11 entry:
     12   %0 = getelementptr i32 addrspace(1)* %in, i64 1
     13   %1 = load i32 addrspace(1)* %0
     14   store i32 %1, i32 addrspace(1)* %out
     15   ret void
     16 }
     17 
     18 ; MUBUF load with the largest possible immediate offset
     19 ; CHECK-LABEL: @mubuf_load1
     20 ; CHECK: BUFFER_LOAD_UBYTE v{{[0-9]}}, s[{{[0-9]:[0-9]}}] + v[{{[0-9]:[0-9]}}] + 0xfff ; encoding: [0xff,0x8f
     21 define void @mubuf_load1(i8 addrspace(1)* %out, i8 addrspace(1)* %in) {
     22 entry:
     23   %0 = getelementptr i8 addrspace(1)* %in, i64 4095
     24   %1 = load i8 addrspace(1)* %0
     25   store i8 %1, i8 addrspace(1)* %out
     26   ret void
     27 }
     28 
     29 ; MUBUF load with an immediate byte offset that doesn't fit into 12-bits
     30 ; CHECK-LABEL: @mubuf_load2
     31 ; CHECK: BUFFER_LOAD_DWORD v{{[0-9]}}, s[{{[0-9]:[0-9]}}] + v[{{[0-9]:[0-9]}}] + 0x0 ; encoding: [0x00,0x80
     32 define void @mubuf_load2(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
     33 entry:
     34   %0 = getelementptr i32 addrspace(1)* %in, i64 1024
     35   %1 = load i32 addrspace(1)* %0
     36   store i32 %1, i32 addrspace(1)* %out
     37   ret void
     38 }
     39 
     40 ; MUBUF load with a 12-bit immediate offset and a register offset
     41 ; CHECK-LABEL: @mubuf_load3
     42 ; CHECK-NOT: ADD
     43 ; CHECK: BUFFER_LOAD_DWORD v{{[0-9]}}, s[{{[0-9]:[0-9]}}] + v[{{[0-9]:[0-9]}}] + 0x4 ; encoding: [0x04,0x80
     44 define void @mubuf_load3(i32 addrspace(1)* %out, i32 addrspace(1)* %in, i64 %offset) {
     45 entry:
     46   %0 = getelementptr i32 addrspace(1)* %in, i64 %offset
     47   %1 = getelementptr i32 addrspace(1)* %0, i64 1
     48   %2 = load i32 addrspace(1)* %1
     49   store i32 %2, i32 addrspace(1)* %out
     50   ret void
     51 }
     52 
     53 ;;;==========================================================================;;;
     54 ;;; MUBUF STORE TESTS
     55 ;;;==========================================================================;;;
     56 
     57 ; MUBUF store with an immediate byte offset that fits into 12-bits
     58 ; CHECK-LABEL: @mubuf_store0
     59 ; CHECK: BUFFER_STORE_DWORD v{{[0-9]}}, s[{{[0-9]:[0-9]}}] + v[{{[0-9]:[0-9]}}] + 0x4 ; encoding: [0x04,0x80
     60 define void @mubuf_store0(i32 addrspace(1)* %out) {
     61 entry:
     62   %0 = getelementptr i32 addrspace(1)* %out, i64 1
     63   store i32 0, i32 addrspace(1)* %0
     64   ret void
     65 }
     66 
     67 ; MUBUF store with the largest possible immediate offset
     68 ; CHECK-LABEL: @mubuf_store1
     69 ; CHECK: BUFFER_STORE_BYTE v{{[0-9]}}, s[{{[0-9]:[0-9]}}] + v[{{[0-9]:[0-9]}}] + 0xfff ; encoding: [0xff,0x8f
     70 
     71 define void @mubuf_store1(i8 addrspace(1)* %out) {
     72 entry:
     73   %0 = getelementptr i8 addrspace(1)* %out, i64 4095
     74   store i8 0, i8 addrspace(1)* %0
     75   ret void
     76 }
     77 
     78 ; MUBUF store with an immediate byte offset that doesn't fit into 12-bits
     79 ; CHECK-LABEL: @mubuf_store2
     80 ; CHECK: BUFFER_STORE_DWORD v{{[0-9]}}, s[{{[0-9]:[0-9]}}] + v[{{[0-9]:[0-9]}}] + 0x0 ; encoding: [0x00,0x80
     81 define void @mubuf_store2(i32 addrspace(1)* %out) {
     82 entry:
     83   %0 = getelementptr i32 addrspace(1)* %out, i64 1024
     84   store i32 0, i32 addrspace(1)* %0
     85   ret void
     86 }
     87 
     88 ; MUBUF store with a 12-bit immediate offset and a register offset
     89 ; CHECK-LABEL: @mubuf_store3
     90 ; CHECK-NOT: ADD
     91 ; CHECK: BUFFER_STORE_DWORD v{{[0-9]}}, s[{{[0-9]:[0-9]}}] + v[{{[0-9]:[0-9]}}] + 0x4 ; encoding: [0x04,0x80
     92 define void @mubuf_store3(i32 addrspace(1)* %out, i64 %offset) {
     93 entry:
     94   %0 = getelementptr i32 addrspace(1)* %out, i64 %offset
     95   %1 = getelementptr i32 addrspace(1)* %0, i64 1
     96   store i32 0, i32 addrspace(1)* %1
     97   ret void
     98 }
     99