
Similar to 806761a7629df268c8aed49657aeccffa6bca449. For IR files without a target triple, -mtriple= specifies the full target triple while -march= merely sets the architecture part of the default target triple, leaving a target triple which may not make sense, e.g. amdgpu-apple-darwin. Therefore, -march= is error-prone and not recommended for tests without a target triple. The issue has been benign as we recognize $unknown-apple-darwin as ELF instead of rejecting it outrightly. This patch changes AMDGPU tests to not rely on the default OS/environment components. Tests that need fixes are not changed: ``` LLVM :: CodeGen/AMDGPU/fabs.f64.ll LLVM :: CodeGen/AMDGPU/fabs.ll LLVM :: CodeGen/AMDGPU/floor.ll LLVM :: CodeGen/AMDGPU/fneg-fabs.f64.ll LLVM :: CodeGen/AMDGPU/fneg-fabs.ll LLVM :: CodeGen/AMDGPU/r600-infinite-loop-bug-while-reorganizing-vector.ll LLVM :: CodeGen/AMDGPU/schedule-if-2.ll ```
41 lines
1.5 KiB
LLVM
41 lines
1.5 KiB
LLVM
; RUN: llc -mtriple=amdgcn -mcpu=fiji < %s | FileCheck %s
|
|
|
|
; Check transformation shl (or|add x, c2), c1 => or|add (shl x, c1), (c2 << c1)
|
|
; Only one shift if expected, GEP shall not produce a separate shift
|
|
|
|
; CHECK-LABEL: {{^}}add_const_offset:
|
|
; CHECK: v_lshlrev_b32_e32 v[[SHL:[0-9]+]], 4, v0
|
|
; CHECK: v_add_u32_e32 v[[ADD:[0-9]+]], vcc, 0xc80, v[[SHL]]
|
|
; CHECK-NOT: v_lshl
|
|
; CHECK: v_add_u32_e32 v[[ADDRLO:[0-9]+]], vcc, s{{[0-9]+}}, v[[ADD]]
|
|
; CHECK: load_dword v{{[0-9]+}}, v[[[ADDRLO]]:
|
|
define amdgpu_kernel void @add_const_offset(ptr addrspace(1) nocapture %arg) {
|
|
bb:
|
|
%id = tail call i32 @llvm.amdgcn.workitem.id.x()
|
|
%add = add i32 %id, 200
|
|
%shl = shl i32 %add, 2
|
|
%ptr = getelementptr inbounds i32, ptr addrspace(1) %arg, i32 %shl
|
|
%val = load i32, ptr addrspace(1) %ptr, align 4
|
|
store i32 %val, ptr addrspace(1) %arg, align 4
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: {{^}}or_const_offset:
|
|
; CHECK: v_lshlrev_b32_e32 v[[SHL:[0-9]+]], 4, v0
|
|
; CHECK: v_or_b32_e32 v[[OR:[0-9]+]], 0x1000, v[[SHL]]
|
|
; CHECK-NOT: v_lshl
|
|
; CHECK: v_add_u32_e32 v[[ADDRLO:[0-9]+]], vcc, s{{[0-9]+}}, v[[OR]]
|
|
; CHECK: load_dword v{{[0-9]+}}, v[[[ADDRLO]]:
|
|
define amdgpu_kernel void @or_const_offset(ptr addrspace(1) nocapture %arg) {
|
|
bb:
|
|
%id = tail call i32 @llvm.amdgcn.workitem.id.x()
|
|
%add = or i32 %id, 256
|
|
%shl = shl i32 %add, 2
|
|
%ptr = getelementptr inbounds i32, ptr addrspace(1) %arg, i32 %shl
|
|
%val = load i32, ptr addrspace(1) %ptr, align 4
|
|
store i32 %val, ptr addrspace(1) %arg, align 4
|
|
ret void
|
|
}
|
|
|
|
declare i32 @llvm.amdgcn.workitem.id.x()
|