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 ; XUN: llc -march=r600 -mcpu=cypress < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
      4 ; FIXME: Evergreen broken
      5 
      6 ; FUNC-LABEL: {{^}}zextload_global_i1_to_i32:
      7 ; SI: buffer_load_ubyte
      8 ; SI: buffer_store_dword
      9 ; SI: s_endpgm
     10 define void @zextload_global_i1_to_i32(i32 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind {
     11   %a = load i1, i1 addrspace(1)* %in
     12   %ext = zext i1 %a to i32
     13   store i32 %ext, i32 addrspace(1)* %out
     14   ret void
     15 }
     16 
     17 ; FUNC-LABEL: {{^}}sextload_global_i1_to_i32:
     18 ; SI: buffer_load_ubyte
     19 ; SI: v_bfe_i32 {{v[0-9]+}}, {{v[0-9]+}}, 0, 1{{$}}
     20 ; SI: buffer_store_dword
     21 ; SI: s_endpgm
     22 define void @sextload_global_i1_to_i32(i32 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind {
     23   %a = load i1, i1 addrspace(1)* %in
     24   %ext = sext i1 %a to i32
     25   store i32 %ext, i32 addrspace(1)* %out
     26   ret void
     27 }
     28 
     29 ; FUNC-LABEL: {{^}}zextload_global_v1i1_to_v1i32:
     30 ; SI: s_endpgm
     31 define void @zextload_global_v1i1_to_v1i32(<1 x i32> addrspace(1)* %out, <1 x i1> addrspace(1)* nocapture %in) nounwind {
     32   %load = load <1 x i1>, <1 x i1> addrspace(1)* %in
     33   %ext = zext <1 x i1> %load to <1 x i32>
     34   store <1 x i32> %ext, <1 x i32> addrspace(1)* %out
     35   ret void
     36 }
     37 
     38 ; FUNC-LABEL: {{^}}sextload_global_v1i1_to_v1i32:
     39 ; SI: s_endpgm
     40 define void @sextload_global_v1i1_to_v1i32(<1 x i32> addrspace(1)* %out, <1 x i1> addrspace(1)* nocapture %in) nounwind {
     41   %load = load <1 x i1>, <1 x i1> addrspace(1)* %in
     42   %ext = sext <1 x i1> %load to <1 x i32>
     43   store <1 x i32> %ext, <1 x i32> addrspace(1)* %out
     44   ret void
     45 }
     46 
     47 ; FUNC-LABEL: {{^}}zextload_global_v2i1_to_v2i32:
     48 ; SI: s_endpgm
     49 define void @zextload_global_v2i1_to_v2i32(<2 x i32> addrspace(1)* %out, <2 x i1> addrspace(1)* nocapture %in) nounwind {
     50   %load = load <2 x i1>, <2 x i1> addrspace(1)* %in
     51   %ext = zext <2 x i1> %load to <2 x i32>
     52   store <2 x i32> %ext, <2 x i32> addrspace(1)* %out
     53   ret void
     54 }
     55 
     56 ; FUNC-LABEL: {{^}}sextload_global_v2i1_to_v2i32:
     57 ; SI: s_endpgm
     58 define void @sextload_global_v2i1_to_v2i32(<2 x i32> addrspace(1)* %out, <2 x i1> addrspace(1)* nocapture %in) nounwind {
     59   %load = load <2 x i1>, <2 x i1> addrspace(1)* %in
     60   %ext = sext <2 x i1> %load to <2 x i32>
     61   store <2 x i32> %ext, <2 x i32> addrspace(1)* %out
     62   ret void
     63 }
     64 
     65 ; FUNC-LABEL: {{^}}zextload_global_v4i1_to_v4i32:
     66 ; SI: s_endpgm
     67 define void @zextload_global_v4i1_to_v4i32(<4 x i32> addrspace(1)* %out, <4 x i1> addrspace(1)* nocapture %in) nounwind {
     68   %load = load <4 x i1>, <4 x i1> addrspace(1)* %in
     69   %ext = zext <4 x i1> %load to <4 x i32>
     70   store <4 x i32> %ext, <4 x i32> addrspace(1)* %out
     71   ret void
     72 }
     73 
     74 ; FUNC-LABEL: {{^}}sextload_global_v4i1_to_v4i32:
     75 ; SI: s_endpgm
     76 define void @sextload_global_v4i1_to_v4i32(<4 x i32> addrspace(1)* %out, <4 x i1> addrspace(1)* nocapture %in) nounwind {
     77   %load = load <4 x i1>, <4 x i1> addrspace(1)* %in
     78   %ext = sext <4 x i1> %load to <4 x i32>
     79   store <4 x i32> %ext, <4 x i32> addrspace(1)* %out
     80   ret void
     81 }
     82 
     83 ; FUNC-LABEL: {{^}}zextload_global_v8i1_to_v8i32:
     84 ; SI: s_endpgm
     85 define void @zextload_global_v8i1_to_v8i32(<8 x i32> addrspace(1)* %out, <8 x i1> addrspace(1)* nocapture %in) nounwind {
     86   %load = load <8 x i1>, <8 x i1> addrspace(1)* %in
     87   %ext = zext <8 x i1> %load to <8 x i32>
     88   store <8 x i32> %ext, <8 x i32> addrspace(1)* %out
     89   ret void
     90 }
     91 
     92 ; FUNC-LABEL: {{^}}sextload_global_v8i1_to_v8i32:
     93 ; SI: s_endpgm
     94 define void @sextload_global_v8i1_to_v8i32(<8 x i32> addrspace(1)* %out, <8 x i1> addrspace(1)* nocapture %in) nounwind {
     95   %load = load <8 x i1>, <8 x i1> addrspace(1)* %in
     96   %ext = sext <8 x i1> %load to <8 x i32>
     97   store <8 x i32> %ext, <8 x i32> addrspace(1)* %out
     98   ret void
     99 }
    100 
    101 ; FUNC-LABEL: {{^}}zextload_global_v16i1_to_v16i32:
    102 ; SI: s_endpgm
    103 define void @zextload_global_v16i1_to_v16i32(<16 x i32> addrspace(1)* %out, <16 x i1> addrspace(1)* nocapture %in) nounwind {
    104   %load = load <16 x i1>, <16 x i1> addrspace(1)* %in
    105   %ext = zext <16 x i1> %load to <16 x i32>
    106   store <16 x i32> %ext, <16 x i32> addrspace(1)* %out
    107   ret void
    108 }
    109 
    110 ; FUNC-LABEL: {{^}}sextload_global_v16i1_to_v16i32:
    111 ; SI: s_endpgm
    112 define void @sextload_global_v16i1_to_v16i32(<16 x i32> addrspace(1)* %out, <16 x i1> addrspace(1)* nocapture %in) nounwind {
    113   %load = load <16 x i1>, <16 x i1> addrspace(1)* %in
    114   %ext = sext <16 x i1> %load to <16 x i32>
    115   store <16 x i32> %ext, <16 x i32> addrspace(1)* %out
    116   ret void
    117 }
    118 
    119 ; XFUNC-LABEL: {{^}}zextload_global_v32i1_to_v32i32:
    120 ; XSI: s_endpgm
    121 ; define void @zextload_global_v32i1_to_v32i32(<32 x i32> addrspace(1)* %out, <32 x i1> addrspace(1)* nocapture %in) nounwind {
    122 ;   %load = load <32 x i1>, <32 x i1> addrspace(1)* %in
    123 ;   %ext = zext <32 x i1> %load to <32 x i32>
    124 ;   store <32 x i32> %ext, <32 x i32> addrspace(1)* %out
    125 ;   ret void
    126 ; }
    127 
    128 ; XFUNC-LABEL: {{^}}sextload_global_v32i1_to_v32i32:
    129 ; XSI: s_endpgm
    130 ; define void @sextload_global_v32i1_to_v32i32(<32 x i32> addrspace(1)* %out, <32 x i1> addrspace(1)* nocapture %in) nounwind {
    131 ;   %load = load <32 x i1>, <32 x i1> addrspace(1)* %in
    132 ;   %ext = sext <32 x i1> %load to <32 x i32>
    133 ;   store <32 x i32> %ext, <32 x i32> addrspace(1)* %out
    134 ;   ret void
    135 ; }
    136 
    137 ; XFUNC-LABEL: {{^}}zextload_global_v64i1_to_v64i32:
    138 ; XSI: s_endpgm
    139 ; define void @zextload_global_v64i1_to_v64i32(<64 x i32> addrspace(1)* %out, <64 x i1> addrspace(1)* nocapture %in) nounwind {
    140 ;   %load = load <64 x i1>, <64 x i1> addrspace(1)* %in
    141 ;   %ext = zext <64 x i1> %load to <64 x i32>
    142 ;   store <64 x i32> %ext, <64 x i32> addrspace(1)* %out
    143 ;   ret void
    144 ; }
    145 
    146 ; XFUNC-LABEL: {{^}}sextload_global_v64i1_to_v64i32:
    147 ; XSI: s_endpgm
    148 ; define void @sextload_global_v64i1_to_v64i32(<64 x i32> addrspace(1)* %out, <64 x i1> addrspace(1)* nocapture %in) nounwind {
    149 ;   %load = load <64 x i1>, <64 x i1> addrspace(1)* %in
    150 ;   %ext = sext <64 x i1> %load to <64 x i32>
    151 ;   store <64 x i32> %ext, <64 x i32> addrspace(1)* %out
    152 ;   ret void
    153 ; }
    154 
    155 ; FUNC-LABEL: {{^}}zextload_global_i1_to_i64:
    156 ; SI: buffer_load_ubyte [[LOAD:v[0-9]+]],
    157 ; SI: v_mov_b32_e32 {{v[0-9]+}}, 0{{$}}
    158 ; SI: buffer_store_dwordx2
    159 define void @zextload_global_i1_to_i64(i64 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind {
    160   %a = load i1, i1 addrspace(1)* %in
    161   %ext = zext i1 %a to i64
    162   store i64 %ext, i64 addrspace(1)* %out
    163   ret void
    164 }
    165 
    166 ; FUNC-LABEL: {{^}}sextload_global_i1_to_i64:
    167 ; SI: buffer_load_ubyte [[LOAD:v[0-9]+]],
    168 ; SI: v_bfe_i32 [[BFE:v[0-9]+]], {{v[0-9]+}}, 0, 1{{$}}
    169 ; SI: v_ashrrev_i32_e32 v{{[0-9]+}}, 31, [[BFE]]
    170 ; SI: buffer_store_dwordx2
    171 define void @sextload_global_i1_to_i64(i64 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind {
    172   %a = load i1, i1 addrspace(1)* %in
    173   %ext = sext i1 %a to i64
    174   store i64 %ext, i64 addrspace(1)* %out
    175   ret void
    176 }
    177 
    178 ; FUNC-LABEL: {{^}}zextload_global_v1i1_to_v1i64:
    179 ; SI: s_endpgm
    180 define void @zextload_global_v1i1_to_v1i64(<1 x i64> addrspace(1)* %out, <1 x i1> addrspace(1)* nocapture %in) nounwind {
    181   %load = load <1 x i1>, <1 x i1> addrspace(1)* %in
    182   %ext = zext <1 x i1> %load to <1 x i64>
    183   store <1 x i64> %ext, <1 x i64> addrspace(1)* %out
    184   ret void
    185 }
    186 
    187 ; FUNC-LABEL: {{^}}sextload_global_v1i1_to_v1i64:
    188 ; SI: s_endpgm
    189 define void @sextload_global_v1i1_to_v1i64(<1 x i64> addrspace(1)* %out, <1 x i1> addrspace(1)* nocapture %in) nounwind {
    190   %load = load <1 x i1>, <1 x i1> addrspace(1)* %in
    191   %ext = sext <1 x i1> %load to <1 x i64>
    192   store <1 x i64> %ext, <1 x i64> addrspace(1)* %out
    193   ret void
    194 }
    195 
    196 ; FUNC-LABEL: {{^}}zextload_global_v2i1_to_v2i64:
    197 ; SI: s_endpgm
    198 define void @zextload_global_v2i1_to_v2i64(<2 x i64> addrspace(1)* %out, <2 x i1> addrspace(1)* nocapture %in) nounwind {
    199   %load = load <2 x i1>, <2 x i1> addrspace(1)* %in
    200   %ext = zext <2 x i1> %load to <2 x i64>
    201   store <2 x i64> %ext, <2 x i64> addrspace(1)* %out
    202   ret void
    203 }
    204 
    205 ; FUNC-LABEL: {{^}}sextload_global_v2i1_to_v2i64:
    206 ; SI: s_endpgm
    207 define void @sextload_global_v2i1_to_v2i64(<2 x i64> addrspace(1)* %out, <2 x i1> addrspace(1)* nocapture %in) nounwind {
    208   %load = load <2 x i1>, <2 x i1> addrspace(1)* %in
    209   %ext = sext <2 x i1> %load to <2 x i64>
    210   store <2 x i64> %ext, <2 x i64> addrspace(1)* %out
    211   ret void
    212 }
    213 
    214 ; FUNC-LABEL: {{^}}zextload_global_v4i1_to_v4i64:
    215 ; SI: s_endpgm
    216 define void @zextload_global_v4i1_to_v4i64(<4 x i64> addrspace(1)* %out, <4 x i1> addrspace(1)* nocapture %in) nounwind {
    217   %load = load <4 x i1>, <4 x i1> addrspace(1)* %in
    218   %ext = zext <4 x i1> %load to <4 x i64>
    219   store <4 x i64> %ext, <4 x i64> addrspace(1)* %out
    220   ret void
    221 }
    222 
    223 ; FUNC-LABEL: {{^}}sextload_global_v4i1_to_v4i64:
    224 ; SI: s_endpgm
    225 define void @sextload_global_v4i1_to_v4i64(<4 x i64> addrspace(1)* %out, <4 x i1> addrspace(1)* nocapture %in) nounwind {
    226   %load = load <4 x i1>, <4 x i1> addrspace(1)* %in
    227   %ext = sext <4 x i1> %load to <4 x i64>
    228   store <4 x i64> %ext, <4 x i64> addrspace(1)* %out
    229   ret void
    230 }
    231 
    232 ; FUNC-LABEL: {{^}}zextload_global_v8i1_to_v8i64:
    233 ; SI: s_endpgm
    234 define void @zextload_global_v8i1_to_v8i64(<8 x i64> addrspace(1)* %out, <8 x i1> addrspace(1)* nocapture %in) nounwind {
    235   %load = load <8 x i1>, <8 x i1> addrspace(1)* %in
    236   %ext = zext <8 x i1> %load to <8 x i64>
    237   store <8 x i64> %ext, <8 x i64> addrspace(1)* %out
    238   ret void
    239 }
    240 
    241 ; FUNC-LABEL: {{^}}sextload_global_v8i1_to_v8i64:
    242 ; SI: s_endpgm
    243 define void @sextload_global_v8i1_to_v8i64(<8 x i64> addrspace(1)* %out, <8 x i1> addrspace(1)* nocapture %in) nounwind {
    244   %load = load <8 x i1>, <8 x i1> addrspace(1)* %in
    245   %ext = sext <8 x i1> %load to <8 x i64>
    246   store <8 x i64> %ext, <8 x i64> addrspace(1)* %out
    247   ret void
    248 }
    249 
    250 ; FUNC-LABEL: {{^}}zextload_global_v16i1_to_v16i64:
    251 ; SI: s_endpgm
    252 define void @zextload_global_v16i1_to_v16i64(<16 x i64> addrspace(1)* %out, <16 x i1> addrspace(1)* nocapture %in) nounwind {
    253   %load = load <16 x i1>, <16 x i1> addrspace(1)* %in
    254   %ext = zext <16 x i1> %load to <16 x i64>
    255   store <16 x i64> %ext, <16 x i64> addrspace(1)* %out
    256   ret void
    257 }
    258 
    259 ; FUNC-LABEL: {{^}}sextload_global_v16i1_to_v16i64:
    260 ; SI: s_endpgm
    261 define void @sextload_global_v16i1_to_v16i64(<16 x i64> addrspace(1)* %out, <16 x i1> addrspace(1)* nocapture %in) nounwind {
    262   %load = load <16 x i1>, <16 x i1> addrspace(1)* %in
    263   %ext = sext <16 x i1> %load to <16 x i64>
    264   store <16 x i64> %ext, <16 x i64> addrspace(1)* %out
    265   ret void
    266 }
    267 
    268 ; XFUNC-LABEL: {{^}}zextload_global_v32i1_to_v32i64:
    269 ; XSI: s_endpgm
    270 ; define void @zextload_global_v32i1_to_v32i64(<32 x i64> addrspace(1)* %out, <32 x i1> addrspace(1)* nocapture %in) nounwind {
    271 ;   %load = load <32 x i1>, <32 x i1> addrspace(1)* %in
    272 ;   %ext = zext <32 x i1> %load to <32 x i64>
    273 ;   store <32 x i64> %ext, <32 x i64> addrspace(1)* %out
    274 ;   ret void
    275 ; }
    276 
    277 ; XFUNC-LABEL: {{^}}sextload_global_v32i1_to_v32i64:
    278 ; XSI: s_endpgm
    279 ; define void @sextload_global_v32i1_to_v32i64(<32 x i64> addrspace(1)* %out, <32 x i1> addrspace(1)* nocapture %in) nounwind {
    280 ;   %load = load <32 x i1>, <32 x i1> addrspace(1)* %in
    281 ;   %ext = sext <32 x i1> %load to <32 x i64>
    282 ;   store <32 x i64> %ext, <32 x i64> addrspace(1)* %out
    283 ;   ret void
    284 ; }
    285 
    286 ; XFUNC-LABEL: {{^}}zextload_global_v64i1_to_v64i64:
    287 ; XSI: s_endpgm
    288 ; define void @zextload_global_v64i1_to_v64i64(<64 x i64> addrspace(1)* %out, <64 x i1> addrspace(1)* nocapture %in) nounwind {
    289 ;   %load = load <64 x i1>, <64 x i1> addrspace(1)* %in
    290 ;   %ext = zext <64 x i1> %load to <64 x i64>
    291 ;   store <64 x i64> %ext, <64 x i64> addrspace(1)* %out
    292 ;   ret void
    293 ; }
    294 
    295 ; XFUNC-LABEL: {{^}}sextload_global_v64i1_to_v64i64:
    296 ; XSI: s_endpgm
    297 ; define void @sextload_global_v64i1_to_v64i64(<64 x i64> addrspace(1)* %out, <64 x i1> addrspace(1)* nocapture %in) nounwind {
    298 ;   %load = load <64 x i1>, <64 x i1> addrspace(1)* %in
    299 ;   %ext = sext <64 x i1> %load to <64 x i64>
    300 ;   store <64 x i64> %ext, <64 x i64> addrspace(1)* %out
    301 ;   ret void
    302 ; }
    303