|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5 |
| 2 | +; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -passes=amdgpu-attributor %s | FileCheck %s |
| 3 | + |
| 4 | +@buf_shared = internal addrspace(3) global [2080 x i8] poison, align 16 |
| 5 | + |
| 6 | +; Constant expression element may not have a pointer type and the |
| 7 | +; addrspacecast may not be the toplevel operation. |
| 8 | + |
| 9 | + |
| 10 | +; This should infer "amdgpu-no-flat-scratch-init". It should not infer "amdgpu-no-queue-ptr" |
| 11 | +;. |
| 12 | +; CHECK: @buf_shared = internal addrspace(3) global [2080 x i8] poison, align 16 |
| 13 | +; CHECK: @buf_private = internal addrspace(5) global [2080 x i8] poison, align 16 |
| 14 | +;. |
| 15 | +define amdgpu_kernel void @issue120256(ptr addrspace(1) %out) { |
| 16 | +; CHECK-LABEL: define amdgpu_kernel void @issue120256( |
| 17 | +; CHECK-SAME: ptr addrspace(1) [[OUT:%.*]]) #[[ATTR0:[0-9]+]] { |
| 18 | +; CHECK-NEXT: [[CONV_I:%.*]] = and i32 trunc (i64 sub (i64 16, i64 ptrtoint (ptr addrspacecast (ptr addrspace(3) @buf_shared to ptr) to i64)) to i32), 15 |
| 19 | +; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds nuw i8, ptr addrspace(3) @buf_shared, i32 [[CONV_I]] |
| 20 | +; CHECK-NEXT: [[LD:%.*]] = load i8, ptr addrspace(3) [[ADD_PTR]], align 1 |
| 21 | +; CHECK-NEXT: store i8 [[LD]], ptr addrspace(1) [[OUT]], align 1 |
| 22 | +; CHECK-NEXT: ret void |
| 23 | +; |
| 24 | + %conv.i = and i32 trunc (i64 sub (i64 16, i64 ptrtoint (ptr addrspacecast (ptr addrspace(3) @buf_shared to ptr) to i64)) to i32), 15 |
| 25 | + %add.ptr = getelementptr inbounds nuw i8, ptr addrspace(3) @buf_shared, i32 %conv.i |
| 26 | + %ld = load i8, ptr addrspace(3) %add.ptr, align 1 |
| 27 | + store i8 %ld, ptr addrspace(1) %out, align 1 |
| 28 | + ret void |
| 29 | +} |
| 30 | + |
| 31 | +@buf_private = internal addrspace(5) global [2080 x i8] poison, align 16 |
| 32 | + |
| 33 | +; Constant expression element may not have a pointer type and the |
| 34 | +; addrspacecast may not be the toplevel operation. |
| 35 | + |
| 36 | +; This should not infer "amdgpu-no-flat-scratch-init" nor "amdgpu-no-queue-ptr" |
| 37 | +define amdgpu_kernel void @issue120256_private(ptr addrspace(1) %out) { |
| 38 | +; CHECK-LABEL: define amdgpu_kernel void @issue120256_private( |
| 39 | +; CHECK-SAME: ptr addrspace(1) [[OUT:%.*]]) #[[ATTR1:[0-9]+]] { |
| 40 | +; CHECK-NEXT: [[CONV_I:%.*]] = and i32 trunc (i64 sub (i64 16, i64 ptrtoint (ptr addrspacecast (ptr addrspace(5) @buf_private to ptr) to i64)) to i32), 15 |
| 41 | +; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds nuw i8, ptr addrspace(5) @buf_private, i32 [[CONV_I]] |
| 42 | +; CHECK-NEXT: [[LD:%.*]] = load i8, ptr addrspace(5) [[ADD_PTR]], align 1 |
| 43 | +; CHECK-NEXT: store i8 [[LD]], ptr addrspace(1) [[OUT]], align 1 |
| 44 | +; CHECK-NEXT: ret void |
| 45 | +; |
| 46 | + %conv.i = and i32 trunc (i64 sub (i64 16, i64 ptrtoint (ptr addrspacecast (ptr addrspace(5) @buf_private to ptr) to i64)) to i32), 15 |
| 47 | + %add.ptr = getelementptr inbounds nuw i8, ptr addrspace(5) @buf_private, i32 %conv.i |
| 48 | + %ld = load i8, ptr addrspace(5) %add.ptr, align 1 |
| 49 | + store i8 %ld, ptr addrspace(1) %out, align 1 |
| 50 | + ret void |
| 51 | +} |
| 52 | + |
| 53 | +!llvm.module.flags = !{!0} |
| 54 | + |
| 55 | +; FIXME: Inference of amdgpu-no-queue-ptr should not depend on code object version. |
| 56 | +!0 = !{i32 1, !"amdhsa_code_object_version", i32 400} |
| 57 | +;. |
| 58 | +; CHECK: attributes #[[ATTR0]] = { "amdgpu-no-agpr" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "target-cpu"="gfx803" "uniform-work-group-size"="false" } |
| 59 | +; CHECK: attributes #[[ATTR1]] = { "amdgpu-no-agpr" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "target-cpu"="gfx803" "uniform-work-group-size"="false" } |
| 60 | +;. |
| 61 | +; CHECK: [[META0:![0-9]+]] = !{i32 1, !"amdhsa_code_object_version", i32 400} |
| 62 | +;. |
0 commit comments