Files
clang-p2996/llvm/test/CodeGen/AMDGPU/loop-idiom.ll
Alexander Richardson ee13638362 [AMDGPU] Remove explicit datalayout from tests where not needed
Since e39f6c1844 opt will infer the
correct datalayout when given a triple. Avoid explicitly specifying it
in tests that depend on the AMDGPU target being present to avoid the
string becoming out of sync with the TargetInfo value.
Only tests with REQUIRES: amdgpu-registered-target or a local lit.cfg
were updated to ensure that tests for non-target-specific passes that
happen to use the AMDGPU layout still pass when building with a limited
set of targets.

Reviewed By: shiltian, arsenm

Pull Request: https://github.com/llvm/llvm-project/pull/137921
2025-04-30 10:58:17 -07:00

51 lines
1.6 KiB
LLVM

; RUN: opt -passes=loop-idiom -S < %s -mtriple=r600 -mcpu=redwood | FileCheck --check-prefix=R600 --check-prefix=FUNC %s
; RUN: opt -passes=loop-idiom -S < %s -mtriple=amdgcn -mcpu=tahiti -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s
; RUN: opt -passes=loop-idiom -S < %s -mtriple=amdgcn -mcpu=tonga -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s
; Make sure loop-idiom doesn't create memcpy or memset. There are no library
; implementations of these for R600.
; FUNC: @no_memcpy
; R600-NOT: {{^}}llvm.memcpy
; SI-NOT: {{^}}llvm.memcpy
define amdgpu_kernel void @no_memcpy(ptr addrspace(3) %in, i32 %size) {
entry:
%dest = alloca i8, i32 32, addrspace(5)
br label %for.body
for.body:
%0 = phi i32 [0, %entry], [%4, %for.body]
%1 = getelementptr i8, ptr addrspace(3) %in, i32 %0
%2 = getelementptr i8, ptr addrspace(5) %dest, i32 %0
%3 = load i8, ptr addrspace(3) %1
store i8 %3, ptr addrspace(5) %2
%4 = add i32 %0, 1
%5 = icmp eq i32 %4, %size
br i1 %5, label %for.end, label %for.body
for.end:
ret void
}
; FUNC: @no_memset
; R600-NOT: {{^}}llvm.memset
; R600-NOT: {{^}}memset_pattern16:
; SI-NOT: {{^}}llvm.memset
; SI-NOT: {{^}}memset_pattern16:
define amdgpu_kernel void @no_memset(i32 %size) {
entry:
%dest = alloca i8, i32 32, addrspace(5)
br label %for.body
for.body:
%0 = phi i32 [0, %entry], [%2, %for.body]
%1 = getelementptr i8, ptr addrspace(5) %dest, i32 %0
store i8 0, ptr addrspace(5) %1
%2 = add i32 %0, 1
%3 = icmp eq i32 %2, %size
br i1 %3, label %for.end, label %for.body
for.end:
ret void
}