brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 83c0ef7 Raw
52 lines · plain
1; RUN: llc -mtriple=amdgcn < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s2; RUN: llc -mtriple=amdgcn -mcpu=tonga < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s3 4; Test that we correctly commute a sub instruction5; FUNC-LABEL: {{^}}sub_rev:6; SI-NOT: v_sub_i32_e32 v{{[0-9]+}}, vcc, s7; SI: v_subrev_{{[iu]}}32_e32 v{{[0-9]+}}, vcc, s8 9; ModuleID = 'vop-shrink.ll'10 11define amdgpu_kernel void @sub_rev(ptr addrspace(1) %out, <4 x i32> %sgpr, i32 %cond) {12entry:13  %vgpr = call i32 @llvm.amdgcn.workitem.id.x() #114  %tmp = icmp eq i32 %cond, 015  br i1 %tmp, label %if, label %else16 17if:                                               ; preds = %entry18  %tmp1 = getelementptr i32, ptr addrspace(1) %out, i32 119  %tmp2 = extractelement <4 x i32> %sgpr, i32 120  store i32 %tmp2, ptr addrspace(1) %out21  br label %endif22 23else:                                             ; preds = %entry24  %tmp3 = extractelement <4 x i32> %sgpr, i32 225  %tmp4 = sub i32 %vgpr, %tmp326  store i32 %tmp4, ptr addrspace(1) %out27  br label %endif28 29endif:                                            ; preds = %else, %if30  ret void31}32 33; Test that we fold an immediate that was illegal for a 64-bit op into the34; 32-bit op when we shrink it.35 36; FUNC-LABEL: {{^}}add_fold:37; SI: v_add_f32_e32 v{{[0-9]+}}, 0x4480000038define amdgpu_kernel void @add_fold(ptr addrspace(1) %out) {39entry:40  %tmp = call i32 @llvm.amdgcn.workitem.id.x()41  %tmp1 = uitofp i32 %tmp to float42  %tmp2 = fadd float %tmp1, 1.024000e+0343  store float %tmp2, ptr addrspace(1) %out44  ret void45}46 47; Function Attrs: nounwind readnone48declare i32 @llvm.amdgcn.workitem.id.x() #049 50attributes #0 = { nounwind readnone }51attributes #1 = { readnone }52