1 ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=EG --check-prefix=FUNC %s 2 ; RUN: llc < %s -march=r600 -mcpu=verde -verify-machineinstrs | FileCheck --check-prefix=SI --check-prefix=FUNC %s 3 4 ; FUNC-LABEL: @vector_read 5 ; EG: MOV 6 ; EG: MOV 7 ; EG: MOV 8 ; EG: MOV 9 ; EG: MOVA_INT 10 define void @vector_read(i32 addrspace(1)* %out, i32 %index) { 11 entry: 12 %0 = alloca [4 x i32] 13 %x = getelementptr [4 x i32]* %0, i32 0, i32 0 14 %y = getelementptr [4 x i32]* %0, i32 0, i32 1 15 %z = getelementptr [4 x i32]* %0, i32 0, i32 2 16 %w = getelementptr [4 x i32]* %0, i32 0, i32 3 17 store i32 0, i32* %x 18 store i32 1, i32* %y 19 store i32 2, i32* %z 20 store i32 3, i32* %w 21 %1 = getelementptr [4 x i32]* %0, i32 0, i32 %index 22 %2 = load i32* %1 23 store i32 %2, i32 addrspace(1)* %out 24 ret void 25 } 26 27 ; FUNC-LABEL: @vector_write 28 ; EG: MOV 29 ; EG: MOV 30 ; EG: MOV 31 ; EG: MOV 32 ; EG: MOVA_INT 33 ; EG: MOVA_INT 34 define void @vector_write(i32 addrspace(1)* %out, i32 %w_index, i32 %r_index) { 35 entry: 36 %0 = alloca [4 x i32] 37 %x = getelementptr [4 x i32]* %0, i32 0, i32 0 38 %y = getelementptr [4 x i32]* %0, i32 0, i32 1 39 %z = getelementptr [4 x i32]* %0, i32 0, i32 2 40 %w = getelementptr [4 x i32]* %0, i32 0, i32 3 41 store i32 0, i32* %x 42 store i32 0, i32* %y 43 store i32 0, i32* %z 44 store i32 0, i32* %w 45 %1 = getelementptr [4 x i32]* %0, i32 0, i32 %w_index 46 store i32 1, i32* %1 47 %2 = getelementptr [4 x i32]* %0, i32 0, i32 %r_index 48 %3 = load i32* %2 49 store i32 %3, i32 addrspace(1)* %out 50 ret void 51 } 52 53 ; This test should be optimize to: 54 ; store i32 0, i32 addrspace(1)* %out 55 ; FUNC-LABEL: @bitcast_gep 56 ; CHECK: STORE_RAW 57 define void @bitcast_gep(i32 addrspace(1)* %out, i32 %w_index, i32 %r_index) { 58 entry: 59 %0 = alloca [4 x i32] 60 %x = getelementptr [4 x i32]* %0, i32 0, i32 0 61 %y = getelementptr [4 x i32]* %0, i32 0, i32 1 62 %z = getelementptr [4 x i32]* %0, i32 0, i32 2 63 %w = getelementptr [4 x i32]* %0, i32 0, i32 3 64 store i32 0, i32* %x 65 store i32 0, i32* %y 66 store i32 0, i32* %z 67 store i32 0, i32* %w 68 %1 = getelementptr [4 x i32]* %0, i32 0, i32 1 69 %2 = bitcast i32* %1 to [4 x i32]* 70 %3 = getelementptr [4 x i32]* %2, i32 0, i32 0 71 %4 = load i32* %3 72 store i32 %4, i32 addrspace(1)* %out 73 ret void 74 } 75