|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-promote-alloca < %s | FileCheck %s |
| 3 | +target triple = "amdgcn-amd-amdhsa" |
| 4 | +define amdgpu_ps void @scalar_alloca_ptr_with_vector_gep_of_gep(i32 %j) #0 { |
| 5 | +; CHECK-LABEL: define amdgpu_ps void @scalar_alloca_ptr_with_vector_gep_of_gep( |
| 6 | +; CHECK-SAME: i32 [[J:%.*]]) #[[ATTR0:[0-9]+]] { |
| 7 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 8 | +; CHECK-NEXT: [[SORTEDFRAGMENTS:%.*]] = freeze <20 x i32> poison |
| 9 | +; CHECK-NEXT: [[TMP0:%.*]] = mul i32 [[J]], 2 |
| 10 | +; CHECK-NEXT: [[TMP1:%.*]] = mul i32 [[J]], 2 |
| 11 | +; CHECK-NEXT: [[TMP2:%.*]] = add i32 1, [[TMP1]] |
| 12 | +; CHECK-NEXT: [[TMP3:%.*]] = extractelement <20 x i32> [[SORTEDFRAGMENTS]], i32 [[TMP2]] |
| 13 | +; CHECK-NEXT: ret void |
| 14 | +; |
| 15 | +entry: |
| 16 | + %SortedFragments = alloca [10 x <2 x i32>], align 8, addrspace(5) |
| 17 | + %0 = getelementptr [10 x <2 x i32>], ptr addrspace(5) %SortedFragments, i32 0, i32 %j |
| 18 | + %1 = getelementptr i8, ptr addrspace(5) %0, i32 4 |
| 19 | + %2 = load i32, ptr addrspace(5) %1, align 4 |
| 20 | + ret void |
| 21 | +} |
| 22 | + |
| 23 | +attributes #0 = { "amdgpu-promote-alloca-to-vector-max-regs"="32" } |
| 24 | + |
| 25 | +define amdgpu_cs void @scalar_alloca_ptr_with_vector_gep_of_scratch(i32 inreg, i32 inreg, i32 inreg, <3 x i32> inreg, i32 inreg, <3 x i32> %coord, <2 x i32> %in, i32 %extra, i32 %idx) #1 { |
| 26 | +; CHECK-LABEL: define amdgpu_cs void @scalar_alloca_ptr_with_vector_gep_of_scratch( |
| 27 | +; CHECK-SAME: i32 inreg [[TMP0:%.*]], i32 inreg [[TMP1:%.*]], i32 inreg [[TMP2:%.*]], <3 x i32> inreg [[TMP3:%.*]], i32 inreg [[TMP4:%.*]], <3 x i32> [[COORD:%.*]], <2 x i32> [[IN:%.*]], i32 [[EXTRA:%.*]], i32 [[IDX:%.*]]) #[[ATTR1:[0-9]+]] { |
| 28 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 29 | +; CHECK-NEXT: [[V:%.*]] = freeze <3 x i32> poison |
| 30 | +; CHECK-NEXT: [[TMP5:%.*]] = insertelement <3 x i32> [[V]], i32 [[EXTRA]], i32 0 |
| 31 | +; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x i32> [[IN]], i64 0 |
| 32 | +; CHECK-NEXT: [[TMP7:%.*]] = insertelement <3 x i32> [[TMP5]], i32 [[TMP6]], i32 1 |
| 33 | +; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x i32> [[IN]], i64 1 |
| 34 | +; CHECK-NEXT: [[TMP9:%.*]] = insertelement <3 x i32> [[TMP7]], i32 [[TMP8]], i32 2 |
| 35 | +; CHECK-NEXT: [[TMP10:%.*]] = add i32 1, [[IDX]] |
| 36 | +; CHECK-NEXT: [[TMP11:%.*]] = extractelement <3 x i32> [[TMP9]], i32 [[TMP10]] |
| 37 | +; CHECK-NEXT: [[XF:%.*]] = bitcast i32 [[TMP11]] to float |
| 38 | +; CHECK-NEXT: call void @llvm.amdgcn.raw.ptr.buffer.store.f32(float [[XF]], ptr addrspace(8) poison, i32 0, i32 0, i32 0) |
| 39 | +; CHECK-NEXT: ret void |
| 40 | +; |
| 41 | +entry: |
| 42 | + %v = alloca [3 x i32], addrspace(5) |
| 43 | + %v1 = getelementptr [3 x i32], ptr addrspace(5) %v, i32 0, i32 1 |
| 44 | + store i32 %extra, ptr addrspace(5) %v |
| 45 | + store <2 x i32> %in, ptr addrspace(5) %v1 |
| 46 | + %e = getelementptr [2 x i32], ptr addrspace(5) %v1, i32 0, i32 %idx |
| 47 | + %x = load i32, ptr addrspace(5) %e |
| 48 | + %xf = bitcast i32 %x to float |
| 49 | + call void @llvm.amdgcn.raw.ptr.buffer.store.f32(float %xf, ptr addrspace(8) poison, i32 0, i32 0, i32 0) |
| 50 | + ret void |
| 51 | +} |
| 52 | + |
| 53 | +attributes #1 = { nounwind "amdgpu-git-ptr-high"="0x1234" } |
| 54 | + |
| 55 | +declare void @llvm.amdgcn.raw.ptr.buffer.store.f32(float, ptr addrspace(8), i32, i32, i32 immarg) |
0 commit comments