Home | History | Annotate | Download | only in AMDGPU
      1 ; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
      2 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs< %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
      3 ; RUN: llc -march=r600 -mcpu=cypress < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
      4 
      5 ; FUNC-LABEL: {{^}}zextload_global_i8_to_i32:
      6 ; SI: buffer_load_ubyte
      7 ; SI: buffer_store_dword
      8 ; SI: s_endpgm
      9 define void @zextload_global_i8_to_i32(i32 addrspace(1)* %out, i8 addrspace(1)* %in) nounwind {
     10   %a = load i8, i8 addrspace(1)* %in
     11   %ext = zext i8 %a to i32
     12   store i32 %ext, i32 addrspace(1)* %out
     13   ret void
     14 }
     15 
     16 ; FUNC-LABEL: {{^}}sextload_global_i8_to_i32:
     17 ; SI: buffer_load_sbyte
     18 ; SI: buffer_store_dword
     19 ; SI: s_endpgm
     20 define void @sextload_global_i8_to_i32(i32 addrspace(1)* %out, i8 addrspace(1)* %in) nounwind {
     21   %a = load i8, i8 addrspace(1)* %in
     22   %ext = sext i8 %a to i32
     23   store i32 %ext, i32 addrspace(1)* %out
     24   ret void
     25 }
     26 
     27 ; FUNC-LABEL: {{^}}zextload_global_v1i8_to_v1i32:
     28 ; SI: s_endpgm
     29 define void @zextload_global_v1i8_to_v1i32(<1 x i32> addrspace(1)* %out, <1 x i8> addrspace(1)* nocapture %in) nounwind {
     30   %load = load <1 x i8>, <1 x i8> addrspace(1)* %in
     31   %ext = zext <1 x i8> %load to <1 x i32>
     32   store <1 x i32> %ext, <1 x i32> addrspace(1)* %out
     33   ret void
     34 }
     35 
     36 ; FUNC-LABEL: {{^}}sextload_global_v1i8_to_v1i32:
     37 ; SI: s_endpgm
     38 define void @sextload_global_v1i8_to_v1i32(<1 x i32> addrspace(1)* %out, <1 x i8> addrspace(1)* nocapture %in) nounwind {
     39   %load = load <1 x i8>, <1 x i8> addrspace(1)* %in
     40   %ext = sext <1 x i8> %load to <1 x i32>
     41   store <1 x i32> %ext, <1 x i32> addrspace(1)* %out
     42   ret void
     43 }
     44 
     45 ; FUNC-LABEL: {{^}}zextload_global_v2i8_to_v2i32:
     46 ; SI: s_endpgm
     47 define void @zextload_global_v2i8_to_v2i32(<2 x i32> addrspace(1)* %out, <2 x i8> addrspace(1)* nocapture %in) nounwind {
     48   %load = load <2 x i8>, <2 x i8> addrspace(1)* %in
     49   %ext = zext <2 x i8> %load to <2 x i32>
     50   store <2 x i32> %ext, <2 x i32> addrspace(1)* %out
     51   ret void
     52 }
     53 
     54 ; FUNC-LABEL: {{^}}sextload_global_v2i8_to_v2i32:
     55 ; SI: s_endpgm
     56 define void @sextload_global_v2i8_to_v2i32(<2 x i32> addrspace(1)* %out, <2 x i8> addrspace(1)* nocapture %in) nounwind {
     57   %load = load <2 x i8>, <2 x i8> addrspace(1)* %in
     58   %ext = sext <2 x i8> %load to <2 x i32>
     59   store <2 x i32> %ext, <2 x i32> addrspace(1)* %out
     60   ret void
     61 }
     62 
     63 ; FUNC-LABEL: {{^}}zextload_global_v4i8_to_v4i32:
     64 ; SI: s_endpgm
     65 define void @zextload_global_v4i8_to_v4i32(<4 x i32> addrspace(1)* %out, <4 x i8> addrspace(1)* nocapture %in) nounwind {
     66   %load = load <4 x i8>, <4 x i8> addrspace(1)* %in
     67   %ext = zext <4 x i8> %load to <4 x i32>
     68   store <4 x i32> %ext, <4 x i32> addrspace(1)* %out
     69   ret void
     70 }
     71 
     72 ; FUNC-LABEL: {{^}}sextload_global_v4i8_to_v4i32:
     73 ; SI: s_endpgm
     74 define void @sextload_global_v4i8_to_v4i32(<4 x i32> addrspace(1)* %out, <4 x i8> addrspace(1)* nocapture %in) nounwind {
     75   %load = load <4 x i8>, <4 x i8> addrspace(1)* %in
     76   %ext = sext <4 x i8> %load to <4 x i32>
     77   store <4 x i32> %ext, <4 x i32> addrspace(1)* %out
     78   ret void
     79 }
     80 
     81 ; FUNC-LABEL: {{^}}zextload_global_v8i8_to_v8i32:
     82 ; SI: s_endpgm
     83 define void @zextload_global_v8i8_to_v8i32(<8 x i32> addrspace(1)* %out, <8 x i8> addrspace(1)* nocapture %in) nounwind {
     84   %load = load <8 x i8>, <8 x i8> addrspace(1)* %in
     85   %ext = zext <8 x i8> %load to <8 x i32>
     86   store <8 x i32> %ext, <8 x i32> addrspace(1)* %out
     87   ret void
     88 }
     89 
     90 ; FUNC-LABEL: {{^}}sextload_global_v8i8_to_v8i32:
     91 ; SI: s_endpgm
     92 define void @sextload_global_v8i8_to_v8i32(<8 x i32> addrspace(1)* %out, <8 x i8> addrspace(1)* nocapture %in) nounwind {
     93   %load = load <8 x i8>, <8 x i8> addrspace(1)* %in
     94   %ext = sext <8 x i8> %load to <8 x i32>
     95   store <8 x i32> %ext, <8 x i32> addrspace(1)* %out
     96   ret void
     97 }
     98 
     99 ; FUNC-LABEL: {{^}}zextload_global_v16i8_to_v16i32:
    100 ; SI: s_endpgm
    101 define void @zextload_global_v16i8_to_v16i32(<16 x i32> addrspace(1)* %out, <16 x i8> addrspace(1)* nocapture %in) nounwind {
    102   %load = load <16 x i8>, <16 x i8> addrspace(1)* %in
    103   %ext = zext <16 x i8> %load to <16 x i32>
    104   store <16 x i32> %ext, <16 x i32> addrspace(1)* %out
    105   ret void
    106 }
    107 
    108 ; FUNC-LABEL: {{^}}sextload_global_v16i8_to_v16i32:
    109 ; SI: s_endpgm
    110 define void @sextload_global_v16i8_to_v16i32(<16 x i32> addrspace(1)* %out, <16 x i8> addrspace(1)* nocapture %in) nounwind {
    111   %load = load <16 x i8>, <16 x i8> addrspace(1)* %in
    112   %ext = sext <16 x i8> %load to <16 x i32>
    113   store <16 x i32> %ext, <16 x i32> addrspace(1)* %out
    114   ret void
    115 }
    116 
    117 ; XFUNC-LABEL: {{^}}zextload_global_v32i8_to_v32i32:
    118 ; XSI: s_endpgm
    119 ; define void @zextload_global_v32i8_to_v32i32(<32 x i32> addrspace(1)* %out, <32 x i8> addrspace(1)* nocapture %in) nounwind {
    120 ;   %load = load <32 x i8>, <32 x i8> addrspace(1)* %in
    121 ;   %ext = zext <32 x i8> %load to <32 x i32>
    122 ;   store <32 x i32> %ext, <32 x i32> addrspace(1)* %out
    123 ;   ret void
    124 ; }
    125 
    126 ; XFUNC-LABEL: {{^}}sextload_global_v32i8_to_v32i32:
    127 ; XSI: s_endpgm
    128 ; define void @sextload_global_v32i8_to_v32i32(<32 x i32> addrspace(1)* %out, <32 x i8> addrspace(1)* nocapture %in) nounwind {
    129 ;   %load = load <32 x i8>, <32 x i8> addrspace(1)* %in
    130 ;   %ext = sext <32 x i8> %load to <32 x i32>
    131 ;   store <32 x i32> %ext, <32 x i32> addrspace(1)* %out
    132 ;   ret void
    133 ; }
    134 
    135 ; XFUNC-LABEL: {{^}}zextload_global_v64i8_to_v64i32:
    136 ; XSI: s_endpgm
    137 ; define void @zextload_global_v64i8_to_v64i32(<64 x i32> addrspace(1)* %out, <64 x i8> addrspace(1)* nocapture %in) nounwind {
    138 ;   %load = load <64 x i8>, <64 x i8> addrspace(1)* %in
    139 ;   %ext = zext <64 x i8> %load to <64 x i32>
    140 ;   store <64 x i32> %ext, <64 x i32> addrspace(1)* %out
    141 ;   ret void
    142 ; }
    143 
    144 ; XFUNC-LABEL: {{^}}sextload_global_v64i8_to_v64i32:
    145 ; XSI: s_endpgm
    146 ; define void @sextload_global_v64i8_to_v64i32(<64 x i32> addrspace(1)* %out, <64 x i8> addrspace(1)* nocapture %in) nounwind {
    147 ;   %load = load <64 x i8>, <64 x i8> addrspace(1)* %in
    148 ;   %ext = sext <64 x i8> %load to <64 x i32>
    149 ;   store <64 x i32> %ext, <64 x i32> addrspace(1)* %out
    150 ;   ret void
    151 ; }
    152 
    153 ; FUNC-LABEL: {{^}}zextload_global_i8_to_i64:
    154 ; SI: buffer_load_ubyte v[[LO:[0-9]+]],
    155 ; SI: v_mov_b32_e32 v[[HI:[0-9]+]], 0{{$}}
    156 ; SI: buffer_store_dwordx2 v{{\[}}[[LO]]:[[HI]]]
    157 define void @zextload_global_i8_to_i64(i64 addrspace(1)* %out, i8 addrspace(1)* %in) nounwind {
    158   %a = load i8, i8 addrspace(1)* %in
    159   %ext = zext i8 %a to i64
    160   store i64 %ext, i64 addrspace(1)* %out
    161   ret void
    162 }
    163 
    164 ; FUNC-LABEL: {{^}}sextload_global_i8_to_i64:
    165 ; SI: buffer_load_sbyte [[LOAD:v[0-9]+]],
    166 ; SI: v_ashrrev_i32_e32 v{{[0-9]+}}, 31, [[LOAD]]
    167 ; SI: buffer_store_dwordx2
    168 define void @sextload_global_i8_to_i64(i64 addrspace(1)* %out, i8 addrspace(1)* %in) nounwind {
    169   %a = load i8, i8 addrspace(1)* %in
    170   %ext = sext i8 %a to i64
    171   store i64 %ext, i64 addrspace(1)* %out
    172   ret void
    173 }
    174 
    175 ; FUNC-LABEL: {{^}}zextload_global_v1i8_to_v1i64:
    176 ; SI: s_endpgm
    177 define void @zextload_global_v1i8_to_v1i64(<1 x i64> addrspace(1)* %out, <1 x i8> addrspace(1)* nocapture %in) nounwind {
    178   %load = load <1 x i8>, <1 x i8> addrspace(1)* %in
    179   %ext = zext <1 x i8> %load to <1 x i64>
    180   store <1 x i64> %ext, <1 x i64> addrspace(1)* %out
    181   ret void
    182 }
    183 
    184 ; FUNC-LABEL: {{^}}sextload_global_v1i8_to_v1i64:
    185 ; SI: s_endpgm
    186 define void @sextload_global_v1i8_to_v1i64(<1 x i64> addrspace(1)* %out, <1 x i8> addrspace(1)* nocapture %in) nounwind {
    187   %load = load <1 x i8>, <1 x i8> addrspace(1)* %in
    188   %ext = sext <1 x i8> %load to <1 x i64>
    189   store <1 x i64> %ext, <1 x i64> addrspace(1)* %out
    190   ret void
    191 }
    192 
    193 ; FUNC-LABEL: {{^}}zextload_global_v2i8_to_v2i64:
    194 ; SI: s_endpgm
    195 define void @zextload_global_v2i8_to_v2i64(<2 x i64> addrspace(1)* %out, <2 x i8> addrspace(1)* nocapture %in) nounwind {
    196   %load = load <2 x i8>, <2 x i8> addrspace(1)* %in
    197   %ext = zext <2 x i8> %load to <2 x i64>
    198   store <2 x i64> %ext, <2 x i64> addrspace(1)* %out
    199   ret void
    200 }
    201 
    202 ; FUNC-LABEL: {{^}}sextload_global_v2i8_to_v2i64:
    203 ; SI: s_endpgm
    204 define void @sextload_global_v2i8_to_v2i64(<2 x i64> addrspace(1)* %out, <2 x i8> addrspace(1)* nocapture %in) nounwind {
    205   %load = load <2 x i8>, <2 x i8> addrspace(1)* %in
    206   %ext = sext <2 x i8> %load to <2 x i64>
    207   store <2 x i64> %ext, <2 x i64> addrspace(1)* %out
    208   ret void
    209 }
    210 
    211 ; FUNC-LABEL: {{^}}zextload_global_v4i8_to_v4i64:
    212 ; SI: s_endpgm
    213 define void @zextload_global_v4i8_to_v4i64(<4 x i64> addrspace(1)* %out, <4 x i8> addrspace(1)* nocapture %in) nounwind {
    214   %load = load <4 x i8>, <4 x i8> addrspace(1)* %in
    215   %ext = zext <4 x i8> %load to <4 x i64>
    216   store <4 x i64> %ext, <4 x i64> addrspace(1)* %out
    217   ret void
    218 }
    219 
    220 ; FUNC-LABEL: {{^}}sextload_global_v4i8_to_v4i64:
    221 ; SI: s_endpgm
    222 define void @sextload_global_v4i8_to_v4i64(<4 x i64> addrspace(1)* %out, <4 x i8> addrspace(1)* nocapture %in) nounwind {
    223   %load = load <4 x i8>, <4 x i8> addrspace(1)* %in
    224   %ext = sext <4 x i8> %load to <4 x i64>
    225   store <4 x i64> %ext, <4 x i64> addrspace(1)* %out
    226   ret void
    227 }
    228 
    229 ; FUNC-LABEL: {{^}}zextload_global_v8i8_to_v8i64:
    230 ; SI: s_endpgm
    231 define void @zextload_global_v8i8_to_v8i64(<8 x i64> addrspace(1)* %out, <8 x i8> addrspace(1)* nocapture %in) nounwind {
    232   %load = load <8 x i8>, <8 x i8> addrspace(1)* %in
    233   %ext = zext <8 x i8> %load to <8 x i64>
    234   store <8 x i64> %ext, <8 x i64> addrspace(1)* %out
    235   ret void
    236 }
    237 
    238 ; FUNC-LABEL: {{^}}sextload_global_v8i8_to_v8i64:
    239 ; SI: s_endpgm
    240 define void @sextload_global_v8i8_to_v8i64(<8 x i64> addrspace(1)* %out, <8 x i8> addrspace(1)* nocapture %in) nounwind {
    241   %load = load <8 x i8>, <8 x i8> addrspace(1)* %in
    242   %ext = sext <8 x i8> %load to <8 x i64>
    243   store <8 x i64> %ext, <8 x i64> addrspace(1)* %out
    244   ret void
    245 }
    246 
    247 ; FUNC-LABEL: {{^}}zextload_global_v16i8_to_v16i64:
    248 ; SI: s_endpgm
    249 define void @zextload_global_v16i8_to_v16i64(<16 x i64> addrspace(1)* %out, <16 x i8> addrspace(1)* nocapture %in) nounwind {
    250   %load = load <16 x i8>, <16 x i8> addrspace(1)* %in
    251   %ext = zext <16 x i8> %load to <16 x i64>
    252   store <16 x i64> %ext, <16 x i64> addrspace(1)* %out
    253   ret void
    254 }
    255 
    256 ; FUNC-LABEL: {{^}}sextload_global_v16i8_to_v16i64:
    257 ; SI: s_endpgm
    258 define void @sextload_global_v16i8_to_v16i64(<16 x i64> addrspace(1)* %out, <16 x i8> addrspace(1)* nocapture %in) nounwind {
    259   %load = load <16 x i8>, <16 x i8> addrspace(1)* %in
    260   %ext = sext <16 x i8> %load to <16 x i64>
    261   store <16 x i64> %ext, <16 x i64> addrspace(1)* %out
    262   ret void
    263 }
    264 
    265 ; XFUNC-LABEL: {{^}}zextload_global_v32i8_to_v32i64:
    266 ; XSI: s_endpgm
    267 ; define void @zextload_global_v32i8_to_v32i64(<32 x i64> addrspace(1)* %out, <32 x i8> addrspace(1)* nocapture %in) nounwind {
    268 ;   %load = load <32 x i8>, <32 x i8> addrspace(1)* %in
    269 ;   %ext = zext <32 x i8> %load to <32 x i64>
    270 ;   store <32 x i64> %ext, <32 x i64> addrspace(1)* %out
    271 ;   ret void
    272 ; }
    273 
    274 ; XFUNC-LABEL: {{^}}sextload_global_v32i8_to_v32i64:
    275 ; XSI: s_endpgm
    276 ; define void @sextload_global_v32i8_to_v32i64(<32 x i64> addrspace(1)* %out, <32 x i8> addrspace(1)* nocapture %in) nounwind {
    277 ;   %load = load <32 x i8>, <32 x i8> addrspace(1)* %in
    278 ;   %ext = sext <32 x i8> %load to <32 x i64>
    279 ;   store <32 x i64> %ext, <32 x i64> addrspace(1)* %out
    280 ;   ret void
    281 ; }
    282 
    283 ; XFUNC-LABEL: {{^}}zextload_global_v64i8_to_v64i64:
    284 ; XSI: s_endpgm
    285 ; define void @zextload_global_v64i8_to_v64i64(<64 x i64> addrspace(1)* %out, <64 x i8> addrspace(1)* nocapture %in) nounwind {
    286 ;   %load = load <64 x i8>, <64 x i8> addrspace(1)* %in
    287 ;   %ext = zext <64 x i8> %load to <64 x i64>
    288 ;   store <64 x i64> %ext, <64 x i64> addrspace(1)* %out
    289 ;   ret void
    290 ; }
    291 
    292 ; XFUNC-LABEL: {{^}}sextload_global_v64i8_to_v64i64:
    293 ; XSI: s_endpgm
    294 ; define void @sextload_global_v64i8_to_v64i64(<64 x i64> addrspace(1)* %out, <64 x i8> addrspace(1)* nocapture %in) nounwind {
    295 ;   %load = load <64 x i8>, <64 x i8> addrspace(1)* %in
    296 ;   %ext = sext <64 x i8> %load to <64 x i64>
    297 ;   store <64 x i64> %ext, <64 x i64> addrspace(1)* %out
    298 ;   ret void
    299 ; }
    300