Files
clang-p2996/llvm/test/CodeGen/AMDGPU/remove-incompatible-gws.ll
Fangrui Song 9e9907f1cf [AMDGPU,test] Change llc -march= to -mtriple= (#75982)
Similar to 806761a762.

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
```
2024-01-16 21:54:58 -08:00

55 lines
2.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -stop-after=amdgpu-remove-incompatible-functions\
; RUN: -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefixes=COMPATIBLE,IR %s
; RUN: FileCheck -allow-empty --check-prefix=WARN-COMPATIBLE %s < %t
; RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -verify-machineinstrs < %s
; RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -stop-after=amdgpu-remove-incompatible-functions\
; RUN: -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefixes=INCOMPATIBLE,IR %s
; RUN: FileCheck --check-prefixes=WARN-INCOMPATIBLE %s < %t
; RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs < %s
; Note: This test checks the IR, but also has a run line to codegen the file just to check we
; do not crash when trying to select those functions.
; WARN-COMPATIBLE-NOT: removing function 'needs_gws':
; WARN-INCOMPATIBLE: removing function 'needs_gws': +gws is not supported on the current target
; COMPATIBLE: @GVRefs {{.*}} [ptr @needs_gws]
; INCOMPATIBLE: @GVRefs {{.*}} zeroinitializer
@GVRefs = internal global [1 x ptr] [
ptr @needs_gws
]
; COMPATIBLE: @ConstantExpr = internal global i64 ptrtoint (ptr @needs_gws to i64)
; INCOMPATIBLE: @ConstantExpr = internal global i64 0
@ConstantExpr = internal global i64 ptrtoint (ptr @needs_gws to i64)
; COMPATIBLE: define void @needs_gws
; INCOMPATIBLE-NOT: define void @needs_gws
define void @needs_gws(i32 %val0, i32 %val1) #0 {
call void @llvm.amdgcn.ds.gws.init(i32 %val0, i32 %val1)
call void @llvm.amdgcn.ds.gws.barrier(i32 %val0, i32 %val1)
ret void
}
; IR: define void @gws_caller(
define void @gws_caller(i32 %val0, i32 %val1) {
; COMPATIBLE: call void @needs_gws(
; INCOMPATIBLE: call void null
call void @needs_gws(i32 %val0, i32 %val1)
; IR: ret void
ret void
}
declare void @llvm.amdgcn.ds.gws.barrier(i32, i32) #1
declare void @llvm.amdgcn.ds.gws.init(i32, i32) #2
attributes #0 = { "target-features"="+gws"}
attributes #1 = { convergent inaccessiblememonly nounwind }
attributes #2 = { convergent inaccessiblememonly nounwind writeonly }