Home | History | Annotate | Download | only in R600
      1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
      2 
      3 declare i32 @llvm.ctlz.i32(i32, i1) nounwind readnone
      4 declare <2 x i32> @llvm.ctlz.v2i32(<2 x i32>, i1) nounwind readnone
      5 declare <4 x i32> @llvm.ctlz.v4i32(<4 x i32>, i1) nounwind readnone
      6 
      7 ; FUNC-LABEL: @s_ctlz_zero_undef_i32:
      8 ; SI: S_LOAD_DWORD [[VAL:s[0-9]+]],
      9 ; SI: S_FLBIT_I32_B32 [[SRESULT:s[0-9]+]], [[VAL]]
     10 ; SI: V_MOV_B32_e32 [[VRESULT:v[0-9]+]], [[SRESULT]]
     11 ; SI: BUFFER_STORE_DWORD [[VRESULT]],
     12 ; SI: S_ENDPGM
     13 define void @s_ctlz_zero_undef_i32(i32 addrspace(1)* noalias %out, i32 %val) nounwind {
     14   %ctlz = call i32 @llvm.ctlz.i32(i32 %val, i1 true) nounwind readnone
     15   store i32 %ctlz, i32 addrspace(1)* %out, align 4
     16   ret void
     17 }
     18 
     19 ; FUNC-LABEL: @v_ctlz_zero_undef_i32:
     20 ; SI: BUFFER_LOAD_DWORD [[VAL:v[0-9]+]],
     21 ; SI: V_FFBH_U32_e32 [[RESULT:v[0-9]+]], [[VAL]]
     22 ; SI: BUFFER_STORE_DWORD [[RESULT]],
     23 ; SI: S_ENDPGM
     24 define void @v_ctlz_zero_undef_i32(i32 addrspace(1)* noalias %out, i32 addrspace(1)* noalias %valptr) nounwind {
     25   %val = load i32 addrspace(1)* %valptr, align 4
     26   %ctlz = call i32 @llvm.ctlz.i32(i32 %val, i1 true) nounwind readnone
     27   store i32 %ctlz, i32 addrspace(1)* %out, align 4
     28   ret void
     29 }
     30 
     31 ; FUNC-LABEL: @v_ctlz_zero_undef_v2i32:
     32 ; SI: BUFFER_LOAD_DWORDX2
     33 ; SI: V_FFBH_U32_e32
     34 ; SI: V_FFBH_U32_e32
     35 ; SI: BUFFER_STORE_DWORDX2
     36 ; SI: S_ENDPGM
     37 define void @v_ctlz_zero_undef_v2i32(<2 x i32> addrspace(1)* noalias %out, <2 x i32> addrspace(1)* noalias %valptr) nounwind {
     38   %val = load <2 x i32> addrspace(1)* %valptr, align 8
     39   %ctlz = call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> %val, i1 true) nounwind readnone
     40   store <2 x i32> %ctlz, <2 x i32> addrspace(1)* %out, align 8
     41   ret void
     42 }
     43 
     44 ; FUNC-LABEL: @v_ctlz_zero_undef_v4i32:
     45 ; SI: BUFFER_LOAD_DWORDX4
     46 ; SI: V_FFBH_U32_e32
     47 ; SI: V_FFBH_U32_e32
     48 ; SI: V_FFBH_U32_e32
     49 ; SI: V_FFBH_U32_e32
     50 ; SI: BUFFER_STORE_DWORDX4
     51 ; SI: S_ENDPGM
     52 define void @v_ctlz_zero_undef_v4i32(<4 x i32> addrspace(1)* noalias %out, <4 x i32> addrspace(1)* noalias %valptr) nounwind {
     53   %val = load <4 x i32> addrspace(1)* %valptr, align 16
     54   %ctlz = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %val, i1 true) nounwind readnone
     55   store <4 x i32> %ctlz, <4 x i32> addrspace(1)* %out, align 16
     56   ret void
     57 }
     58