Home | History | Annotate | Download | only in R600
      1 ; RUN: llc -march=r600 -mcpu=cypress < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
      2 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
      3 
      4 ; FUNC-LABEL: @anyext_load_i8:
      5 ; EG: AND_INT
      6 ; EG: 255
      7 define void @anyext_load_i8(i8 addrspace(1)* nocapture noalias %out, i8 addrspace(1)* nocapture noalias %src) nounwind {
      8   %cast = bitcast i8 addrspace(1)* %src to i32 addrspace(1)*
      9   %load = load i32 addrspace(1)* %cast, align 1
     10   %x = bitcast i32 %load to <4 x i8>
     11   %castOut = bitcast i8 addrspace(1)* %out to <4 x i8> addrspace(1)*
     12   store <4 x i8> %x, <4 x i8> addrspace(1)* %castOut, align 1
     13   ret void
     14 }
     15 
     16 ; FUNC-LABEL: @anyext_load_i16:
     17 ; EG: AND_INT
     18 ; EG: AND_INT
     19 ; EG-DAG: 65535
     20 ; EG-DAG: -65536
     21 define void @anyext_load_i16(i16 addrspace(1)* nocapture noalias %out, i16 addrspace(1)* nocapture noalias %src) nounwind {
     22   %cast = bitcast i16 addrspace(1)* %src to i32 addrspace(1)*
     23   %load = load i32 addrspace(1)* %cast, align 1
     24   %x = bitcast i32 %load to <2 x i16>
     25   %castOut = bitcast i16 addrspace(1)* %out to <2 x i16> addrspace(1)*
     26   store <2 x i16> %x, <2 x i16> addrspace(1)* %castOut, align 1
     27   ret void
     28 }
     29 
     30 ; FUNC-LABEL: @anyext_load_lds_i8:
     31 ; EG: AND_INT
     32 ; EG: 255
     33 define void @anyext_load_lds_i8(i8 addrspace(3)* nocapture noalias %out, i8 addrspace(3)* nocapture noalias %src) nounwind {
     34   %cast = bitcast i8 addrspace(3)* %src to i32 addrspace(3)*
     35   %load = load i32 addrspace(3)* %cast, align 1
     36   %x = bitcast i32 %load to <4 x i8>
     37   %castOut = bitcast i8 addrspace(3)* %out to <4 x i8> addrspace(3)*
     38   store <4 x i8> %x, <4 x i8> addrspace(3)* %castOut, align 1
     39   ret void
     40 }
     41 
     42 ; FUNC-LABEL: @anyext_load_lds_i16:
     43 ; EG: AND_INT
     44 ; EG: AND_INT
     45 ; EG-DAG: 65535
     46 ; EG-DAG: -65536
     47 define void @anyext_load_lds_i16(i16 addrspace(3)* nocapture noalias %out, i16 addrspace(3)* nocapture noalias %src) nounwind {
     48   %cast = bitcast i16 addrspace(3)* %src to i32 addrspace(3)*
     49   %load = load i32 addrspace(3)* %cast, align 1
     50   %x = bitcast i32 %load to <2 x i16>
     51   %castOut = bitcast i16 addrspace(3)* %out to <2 x i16> addrspace(3)*
     52   store <2 x i16> %x, <2 x i16> addrspace(3)* %castOut, align 1
     53   ret void
     54 }
     55 
     56 ; FUNC-LABEL: @sextload_global_i8_to_i64
     57 ; SI: BUFFER_LOAD_SBYTE [[LOAD:v[0-9]+]],
     58 ; SI: V_ASHRREV_I32_e32 v{{[0-9]+}}, 31, [[LOAD]]
     59 ; SI: BUFFER_STORE_DWORDX2
     60 define void @sextload_global_i8_to_i64(i64 addrspace(1)* %out, i8 addrspace(1)* %in) nounwind {
     61   %a = load i8 addrspace(1)* %in, align 8
     62   %ext = sext i8 %a to i64
     63   store i64 %ext, i64 addrspace(1)* %out, align 8
     64   ret void
     65 }
     66 
     67 ; FUNC-LABEL: @sextload_global_i16_to_i64
     68 ; SI: BUFFER_LOAD_SSHORT [[LOAD:v[0-9]+]],
     69 ; SI: V_ASHRREV_I32_e32 v{{[0-9]+}}, 31, [[LOAD]]
     70 ; SI: BUFFER_STORE_DWORDX2
     71 define void @sextload_global_i16_to_i64(i64 addrspace(1)* %out, i16 addrspace(1)* %in) nounwind {
     72   %a = load i16 addrspace(1)* %in, align 8
     73   %ext = sext i16 %a to i64
     74   store i64 %ext, i64 addrspace(1)* %out, align 8
     75   ret void
     76 }
     77 
     78 ; FUNC-LABEL: @sextload_global_i32_to_i64
     79 ; SI: BUFFER_LOAD_DWORD [[LOAD:v[0-9]+]],
     80 ; SI: V_ASHRREV_I32_e32 v{{[0-9]+}}, 31, [[LOAD]]
     81 ; SI: BUFFER_STORE_DWORDX2
     82 define void @sextload_global_i32_to_i64(i64 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind {
     83   %a = load i32 addrspace(1)* %in, align 8
     84   %ext = sext i32 %a to i64
     85   store i64 %ext, i64 addrspace(1)* %out, align 8
     86   ret void
     87 }
     88 
     89 ; FUNC-LABEL: @zextload_global_i8_to_i64
     90 ; SI: S_MOV_B32 [[ZERO:s[0-9]+]], 0
     91 ; SI: BUFFER_LOAD_UBYTE [[LOAD:v[0-9]+]],
     92 ; SI: V_MOV_B32_e32 {{v[0-9]+}}, [[ZERO]]
     93 ; SI: BUFFER_STORE_DWORDX2
     94 define void @zextload_global_i8_to_i64(i64 addrspace(1)* %out, i8 addrspace(1)* %in) nounwind {
     95   %a = load i8 addrspace(1)* %in, align 8
     96   %ext = zext i8 %a to i64
     97   store i64 %ext, i64 addrspace(1)* %out, align 8
     98   ret void
     99 }
    100 
    101 ; FUNC-LABEL: @zextload_global_i16_to_i64
    102 ; SI: S_MOV_B32 [[ZERO:s[0-9]+]], 0
    103 ; SI: BUFFER_LOAD_USHORT [[LOAD:v[0-9]+]],
    104 ; SI: V_MOV_B32_e32 {{v[0-9]+}}, [[ZERO]]
    105 ; SI: BUFFER_STORE_DWORDX2
    106 define void @zextload_global_i16_to_i64(i64 addrspace(1)* %out, i16 addrspace(1)* %in) nounwind {
    107   %a = load i16 addrspace(1)* %in, align 8
    108   %ext = zext i16 %a to i64
    109   store i64 %ext, i64 addrspace(1)* %out, align 8
    110   ret void
    111 }
    112 
    113 ; FUNC-LABEL: @zextload_global_i32_to_i64
    114 ; SI: S_MOV_B32 [[ZERO:s[0-9]+]], 0
    115 ; SI: BUFFER_LOAD_DWORD [[LOAD:v[0-9]+]],
    116 ; SI: V_MOV_B32_e32 {{v[0-9]+}}, [[ZERO]]
    117 ; SI: BUFFER_STORE_DWORDX2
    118 define void @zextload_global_i32_to_i64(i64 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind {
    119   %a = load i32 addrspace(1)* %in, align 8
    120   %ext = zext i32 %a to i64
    121   store i64 %ext, i64 addrspace(1)* %out, align 8
    122   ret void
    123 }
    124