xref: /llvm-project/llvm/test/CodeGen/AMDGPU/remove-incompatible-extended-image-insts.ll (revision b1bcb7ca460fcd317bbc8309e14c8761bf8394e0)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=amdgcn -mcpu=gfx908 -stop-after=amdgpu-remove-incompatible-functions\
3; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefix=EXTIMG %s
4; RUN: FileCheck -allow-empty --check-prefix=WARN-EXTIMG %s < %t
5; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s
6
7; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -stop-after=amdgpu-remove-incompatible-functions\
8; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefix=NOEXTIMG %s
9; RUN: FileCheck --check-prefix=WARN-NOEXTIMG %s < %t
10; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -verify-machineinstrs < %s
11
12; Note: This test checks the IR, but also has a run line to codegen the file just to check we
13; do not crash when trying to select those functions.
14
15; WARN-EXTIMG-NOT: removing function 'needs_extimg':
16; WARN-NOEXTIMG:   removing function 'needs_extimg': +extended-image-insts is not supported on the current target
17
18; EXTIMG:       @GVRefs {{.*}} [ptr @needs_extimg]
19; NOEXTIMG:     @GVRefs {{.*}} zeroinitializer
20@GVRefs = internal global [1 x ptr] [
21  ptr @needs_extimg
22]
23
24; EXTIMG:         @ConstantExpr = internal global i64 ptrtoint (ptr @needs_extimg to i64)
25; NOEXTIMG:       @ConstantExpr = internal global i64 0
26
27@ConstantExpr = internal global i64 ptrtoint (ptr @needs_extimg to i64)
28
29; EXTIMG:         define <4 x float> @needs_extimg
30; NOEXTIMG-NOT:   define <4 x float> @needs_extimg
31define <4 x float> @needs_extimg(float noundef %0, float noundef %1, <8 x i32> noundef %2, <4 x i32> noundef %3) #0 {
32  %5 = tail call <4 x float> @llvm.amdgcn.image.sample.lz.2d.v4f32.f32(i32 noundef 15, float %0, float %1, <8 x i32> %2, <4 x i32> %3, i1 noundef false, i32 noundef 0, i32 noundef 0)
33  ret <4 x float> %5
34}
35
36; IR: define void @caller(
37define void @caller(float noundef %0, float noundef %1, <8 x i32> noundef %2, <4 x i32> noundef %3) {
38  call void @needs_extimg(float %0, float %1, <8 x i32> %2, <4 x i32> %3)
39  ; IR: ret void
40  ret void
41}
42
43declare <4 x float> @llvm.amdgcn.image.sample.lz.2d.v4f32.f32(i32 immarg, float, float, <8 x i32>, <4 x i32>, i1 immarg, i32 immarg, i32 immarg)
44
45attributes #0 = { "target-features"="+extended-image-insts" }
46;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
47; EXTIMG: {{.*}}
48; NOEXTIMG: {{.*}}
49