1; RUN: opt -mtriple=amdgcn-amd-amdhsa -basicaa -load-store-vectorizer -S -o - %s | FileCheck %s 2 3target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" 4 5; Check relative position of the inserted vector load relative to the existing 6; adds. Vectorized loads should be inserted at the position of the first load. 7 8; CHECK-LABEL: @insert_load_point( 9; CHECK: %z = add i32 %x, 4 10; CHECK: load <2 x float> 11; CHECK: %w = add i32 %y, 9 12; CHECK: %foo = add i32 %z, %w 13define void @insert_load_point(float addrspace(1)* nocapture %a, float addrspace(1)* nocapture %b, float addrspace(1)* nocapture readonly %c, i64 %idx, i32 %x, i32 %y) #0 { 14entry: 15 %a.idx.x = getelementptr inbounds float, float addrspace(1)* %a, i64 %idx 16 %c.idx.x = getelementptr inbounds float, float addrspace(1)* %c, i64 %idx 17 %a.idx.x.1 = getelementptr inbounds float, float addrspace(1)* %a.idx.x, i64 1 18 %c.idx.x.1 = getelementptr inbounds float, float addrspace(1)* %c.idx.x, i64 1 19 20 %z = add i32 %x, 4 21 %ld.c = load float, float addrspace(1)* %c.idx.x, align 4 22 %w = add i32 %y, 9 23 %ld.c.idx.1 = load float, float addrspace(1)* %c.idx.x.1, align 4 24 %foo = add i32 %z, %w 25 26 store float 0.0, float addrspace(1)* %a.idx.x, align 4 27 store float 0.0, float addrspace(1)* %a.idx.x.1, align 4 28 29 %add = fadd float %ld.c, %ld.c.idx.1 30 store float %add, float addrspace(1)* %b, align 4 31 store i32 %foo, i32 addrspace(3)* null, align 4 32 ret void 33} 34 35; CHECK-LABEL: @insert_store_point( 36; CHECK: %z = add i32 %x, 4 37; CHECK: %w = add i32 %y, 9 38; CHECK: store <2 x float> 39; CHECK: %foo = add i32 %z, %w 40define void @insert_store_point(float addrspace(1)* nocapture %a, float addrspace(1)* nocapture %b, float addrspace(1)* nocapture readonly %c, i64 %idx, i32 %x, i32 %y) #0 { 41entry: 42 %a.idx.x = getelementptr inbounds float, float addrspace(1)* %a, i64 %idx 43 %c.idx.x = getelementptr inbounds float, float addrspace(1)* %c, i64 %idx 44 %a.idx.x.1 = getelementptr inbounds float, float addrspace(1)* %a.idx.x, i64 1 45 %c.idx.x.1 = getelementptr inbounds float, float addrspace(1)* %c.idx.x, i64 1 46 47 %ld.c = load float, float addrspace(1)* %c.idx.x, align 4 48 %ld.c.idx.1 = load float, float addrspace(1)* %c.idx.x.1, align 4 49 50 %z = add i32 %x, 4 51 store float 0.0, float addrspace(1)* %a.idx.x, align 4 52 %w = add i32 %y, 9 53 store float 0.0, float addrspace(1)* %a.idx.x.1, align 4 54 %foo = add i32 %z, %w 55 56 %add = fadd float %ld.c, %ld.c.idx.1 57 store float %add, float addrspace(1)* %b, align 4 58 store i32 %foo, i32 addrspace(3)* null, align 4 59 ret void 60} 61 62attributes #0 = { nounwind } 63