From 62872e750348edf2564e8d1719ed95e3a52e47ef Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 1 Jul 2019 15:23:03 +0000 Subject: [PATCH] AMDGPU: Fix tests using the default alloca address space git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364783 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/AMDGPU/loop-idiom.ll | 13 +++++++------ test/CodeGen/AMDGPU/unroll.ll | 17 +++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/test/CodeGen/AMDGPU/loop-idiom.ll b/test/CodeGen/AMDGPU/loop-idiom.ll index d783eaa0e4a..d79a35ff6a6 100644 --- a/test/CodeGen/AMDGPU/loop-idiom.ll +++ b/test/CodeGen/AMDGPU/loop-idiom.ll @@ -2,6 +2,7 @@ ; RUN: opt -basicaa -loop-idiom -S < %s -march=amdgcn -mcpu=tahiti -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s ; RUN: opt -basicaa -loop-idiom -S < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s +target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5" ; Make sure loop-idiom doesn't create memcpy or memset. There are no library ; implementations of these for R600. @@ -11,15 +12,15 @@ ; SI-NOT: {{^}}llvm.memcpy define amdgpu_kernel void @no_memcpy(i8 addrspace(3)* %in, i32 %size) { entry: - %dest = alloca i8, i32 32 + %dest = alloca i8, i32 32, addrspace(5) br label %for.body for.body: %0 = phi i32 [0, %entry], [%4, %for.body] %1 = getelementptr i8, i8 addrspace(3)* %in, i32 %0 - %2 = getelementptr i8, i8* %dest, i32 %0 + %2 = getelementptr i8, i8 addrspace(5)* %dest, i32 %0 %3 = load i8, i8 addrspace(3)* %1 - store i8 %3, i8* %2 + store i8 %3, i8 addrspace(5)* %2 %4 = add i32 %0, 1 %5 = icmp eq i32 %4, %size br i1 %5, label %for.end, label %for.body @@ -35,13 +36,13 @@ for.end: ; SI-NOT: {{^}}memset_pattern16: define amdgpu_kernel void @no_memset(i32 %size) { entry: - %dest = alloca i8, i32 32 + %dest = alloca i8, i32 32, addrspace(5) br label %for.body for.body: %0 = phi i32 [0, %entry], [%2, %for.body] - %1 = getelementptr i8, i8* %dest, i32 %0 - store i8 0, i8* %1 + %1 = getelementptr i8, i8 addrspace(5)* %dest, i32 %0 + store i8 0, i8 addrspace(5)* %1 %2 = add i32 %0, 1 %3 = icmp eq i32 %2, %size br i1 %3, label %for.end, label %for.body diff --git a/test/CodeGen/AMDGPU/unroll.ll b/test/CodeGen/AMDGPU/unroll.ll index 2ce4de90a02..ce6afa4fec6 100644 --- a/test/CodeGen/AMDGPU/unroll.ll +++ b/test/CodeGen/AMDGPU/unroll.ll @@ -1,6 +1,7 @@ ; RUN: opt -mtriple=amdgcn-- -loop-unroll -simplifycfg -sroa %s -S -o - | FileCheck %s ; RUN: opt -mtriple=r600-- -loop-unroll -simplifycfg -sroa %s -S -o - | FileCheck %s +target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5" ; This test contains a simple loop that initializes an array declared in ; private memory. We want to make sure these kinds of loops are always @@ -11,7 +12,7 @@ ; CHECK: store i32 5, i32 addrspace(1)* %out define amdgpu_kernel void @private_memory(i32 addrspace(1)* %out) { entry: - %0 = alloca [32 x i32] + %0 = alloca [32 x i32], addrspace(5) br label %loop.header loop.header: @@ -19,8 +20,8 @@ loop.header: br label %loop.body loop.body: - %ptr = getelementptr [32 x i32], [32 x i32]* %0, i32 0, i32 %counter - store i32 %counter, i32* %ptr + %ptr = getelementptr [32 x i32], [32 x i32] addrspace(5)* %0, i32 0, i32 %counter + store i32 %counter, i32 addrspace(5)* %ptr br label %loop.inc loop.inc: @@ -29,8 +30,8 @@ loop.inc: br i1 %1, label %exit, label %loop.header exit: - %2 = getelementptr [32 x i32], [32 x i32]* %0, i32 0, i32 5 - %3 = load i32, i32* %2 + %2 = getelementptr [32 x i32], [32 x i32] addrspace(5)* %0, i32 0, i32 5 + %3 = load i32, i32 addrspace(5)* %2 store i32 %3, i32 addrspace(1)* %out ret void } @@ -74,7 +75,7 @@ exit: ; CHECK-NEXT: getelementptr ; CHECK-NEXT: store ; CHECK-NOT: br -define amdgpu_kernel void @unroll_for_if(i32* %a) { +define amdgpu_kernel void @unroll_for_if(i32 addrspace(5)* %a) { entry: br label %for.body @@ -86,8 +87,8 @@ for.body: ; preds = %entry, %for.inc if.then: ; preds = %for.body %0 = sext i32 %i1 to i64 - %arrayidx = getelementptr inbounds i32, i32* %a, i64 %0 - store i32 0, i32* %arrayidx, align 4 + %arrayidx = getelementptr inbounds i32, i32 addrspace(5)* %a, i64 %0 + store i32 0, i32 addrspace(5)* %arrayidx, align 4 br label %for.inc for.inc: ; preds = %for.body, %if.then -- 2.50.1