1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck %s 2 3 define void @use_gep_address_space([1024 x i32] addrspace(3)* %array) nounwind { 4 ; CHECK-LABEL: @use_gep_address_space: 5 ; CHECK: V_MOV_B32_e32 [[PTR:v[0-9]+]], s{{[0-9]+}} 6 ; CHECK: DS_WRITE_B32 [[PTR]], v{{[0-9]+}}, 0x40 7 %p = getelementptr [1024 x i32] addrspace(3)* %array, i16 0, i16 16 8 store i32 99, i32 addrspace(3)* %p 9 ret void 10 } 11 12 define void @use_gep_address_space_large_offset([1024 x i32] addrspace(3)* %array) nounwind { 13 ; CHECK-LABEL: @use_gep_address_space_large_offset: 14 ; CHECK: S_ADD_I32 15 ; CHECK: DS_WRITE_B32 16 %p = getelementptr [1024 x i32] addrspace(3)* %array, i16 0, i16 16384 17 store i32 99, i32 addrspace(3)* %p 18 ret void 19 } 20 21 define void @gep_as_vector_v4(<4 x [1024 x i32] addrspace(3)*> %array) nounwind { 22 ; CHECK-LABEL: @gep_as_vector_v4: 23 ; CHECK: S_ADD_I32 24 ; CHECK: S_ADD_I32 25 ; CHECK: S_ADD_I32 26 ; CHECK: S_ADD_I32 27 %p = getelementptr <4 x [1024 x i32] addrspace(3)*> %array, <4 x i16> zeroinitializer, <4 x i16> <i16 16, i16 16, i16 16, i16 16> 28 %p0 = extractelement <4 x i32 addrspace(3)*> %p, i32 0 29 %p1 = extractelement <4 x i32 addrspace(3)*> %p, i32 1 30 %p2 = extractelement <4 x i32 addrspace(3)*> %p, i32 2 31 %p3 = extractelement <4 x i32 addrspace(3)*> %p, i32 3 32 store i32 99, i32 addrspace(3)* %p0 33 store i32 99, i32 addrspace(3)* %p1 34 store i32 99, i32 addrspace(3)* %p2 35 store i32 99, i32 addrspace(3)* %p3 36 ret void 37 } 38 39 define void @gep_as_vector_v2(<2 x [1024 x i32] addrspace(3)*> %array) nounwind { 40 ; CHECK-LABEL: @gep_as_vector_v2: 41 ; CHECK: S_ADD_I32 42 ; CHECK: S_ADD_I32 43 %p = getelementptr <2 x [1024 x i32] addrspace(3)*> %array, <2 x i16> zeroinitializer, <2 x i16> <i16 16, i16 16> 44 %p0 = extractelement <2 x i32 addrspace(3)*> %p, i32 0 45 %p1 = extractelement <2 x i32 addrspace(3)*> %p, i32 1 46 store i32 99, i32 addrspace(3)* %p0 47 store i32 99, i32 addrspace(3)* %p1 48 ret void 49 } 50 51