CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
108 lines
4.5 KiB
LLVM
108 lines
4.5 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
|
|
; RUN: opt < %s -O3 -S | FileCheck %s
|
|
|
|
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-apple-macosx11.0.0"
|
|
|
|
; We expect the loop to be vectorized even if it
|
|
; is not unrolled.
|
|
; Verify that fdiv is not sunk back into the loop
|
|
; after getting hoisted - based on this C source:
|
|
;
|
|
; void vdiv(ptr a, float b) {
|
|
; for (int i = 0; i != 1024; ++i)
|
|
; a[i] /= b;
|
|
; }
|
|
|
|
define void @vdiv(ptr %a, float %b) {
|
|
; CHECK-LABEL: define void @vdiv(
|
|
; CHECK-SAME: ptr captures(none) [[A:%.*]], float [[B:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
|
|
; CHECK-NEXT: [[ENTRY:.*]]:
|
|
; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x float> poison, float [[B]], i64 0
|
|
; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x float> [[BROADCAST_SPLATINSERT]], <4 x float> poison, <4 x i32> zeroinitializer
|
|
; CHECK-NEXT: [[TMP0:%.*]] = fdiv fast <4 x float> splat (float 1.000000e+00), [[BROADCAST_SPLAT]]
|
|
; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]
|
|
; CHECK: [[VECTOR_BODY]]:
|
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
|
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw [4 x i8], ptr [[A]], i64 [[INDEX]]
|
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP1]], align 4, !tbaa [[FLOAT_TBAA3:![0-9]+]]
|
|
; CHECK-NEXT: [[TMP3:%.*]] = fmul fast <4 x float> [[WIDE_LOAD]], [[TMP0]]
|
|
; CHECK-NEXT: store <4 x float> [[TMP3]], ptr [[TMP1]], align 4, !tbaa [[FLOAT_TBAA3]]
|
|
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
|
|
; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1024
|
|
; CHECK-NEXT: br i1 [[TMP5]], label %[[FOR_COND_CLEANUP:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP7:![0-9]+]]
|
|
; CHECK: [[FOR_COND_CLEANUP]]:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
%a.addr = alloca ptr, align 8
|
|
%b.addr = alloca float, align 4
|
|
%i = alloca i32, align 4
|
|
store ptr %a, ptr %a.addr, align 8, !tbaa !3
|
|
store float %b, ptr %b.addr, align 4, !tbaa !7
|
|
call void @llvm.lifetime.start.p0(ptr %i)
|
|
store i32 0, ptr %i, align 4, !tbaa !9
|
|
br label %for.cond
|
|
|
|
for.cond: ; preds = %for.inc, %entry
|
|
%0 = load i32, ptr %i, align 4, !tbaa !9
|
|
%cmp = icmp ne i32 %0, 1024
|
|
br i1 %cmp, label %for.body, label %for.cond.cleanup
|
|
|
|
for.cond.cleanup: ; preds = %for.cond
|
|
call void @llvm.lifetime.end.p0(ptr %i)
|
|
br label %for.end
|
|
|
|
for.body: ; preds = %for.cond
|
|
%1 = load float, ptr %b.addr, align 4, !tbaa !7
|
|
%2 = load ptr, ptr %a.addr, align 8, !tbaa !3
|
|
%3 = load i32, ptr %i, align 4, !tbaa !9
|
|
%idxprom = sext i32 %3 to i64
|
|
%arrayidx = getelementptr inbounds float, ptr %2, i64 %idxprom
|
|
%4 = load float, ptr %arrayidx, align 4, !tbaa !7
|
|
%div = fdiv fast float %4, %1
|
|
store float %div, ptr %arrayidx, align 4, !tbaa !7
|
|
br label %for.inc
|
|
|
|
for.inc: ; preds = %for.body
|
|
%5 = load i32, ptr %i, align 4, !tbaa !9
|
|
%inc = add nsw i32 %5, 1
|
|
store i32 %inc, ptr %i, align 4, !tbaa !9
|
|
br label %for.cond, !llvm.loop !11
|
|
|
|
for.end: ; preds = %for.cond.cleanup
|
|
ret void
|
|
}
|
|
|
|
declare void @llvm.lifetime.start.p0(ptr nocapture)
|
|
declare void @llvm.lifetime.end.p0(ptr nocapture)
|
|
|
|
!llvm.module.flags = !{!0, !1}
|
|
!llvm.ident = !{!2}
|
|
|
|
!0 = !{i32 1, !"wchar_size", i32 4}
|
|
!1 = !{i32 7, !"PIC Level", i32 2}
|
|
!2 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 437fb428178716db014f75701f3cdea6dea63f59)"}
|
|
!3 = !{!4, !4, i64 0}
|
|
!4 = !{!"any pointer", !5, i64 0}
|
|
!5 = !{!"omnipotent char", !6, i64 0}
|
|
!6 = !{!"Simple C/C++ TBAA"}
|
|
!7 = !{!8, !8, i64 0}
|
|
!8 = !{!"float", !5, i64 0}
|
|
!9 = !{!10, !10, i64 0}
|
|
!10 = !{!"int", !5, i64 0}
|
|
!11 = distinct !{!11, !12, !13}
|
|
!12 = !{!"llvm.loop.mustprogress"}
|
|
!13 = !{!"llvm.loop.unroll.disable"}
|
|
;.
|
|
; CHECK: [[FLOAT_TBAA3]] = !{[[META4:![0-9]+]], [[META4]], i64 0}
|
|
; CHECK: [[META4]] = !{!"float", [[META5:![0-9]+]], i64 0}
|
|
; CHECK: [[META5]] = !{!"omnipotent char", [[META6:![0-9]+]], i64 0}
|
|
; CHECK: [[META6]] = !{!"Simple C/C++ TBAA"}
|
|
; CHECK: [[LOOP7]] = distinct !{[[LOOP7]], [[META8:![0-9]+]], [[META9:![0-9]+]], [[META10:![0-9]+]], [[META11:![0-9]+]]}
|
|
; CHECK: [[META8]] = !{!"llvm.loop.mustprogress"}
|
|
; CHECK: [[META9]] = !{!"llvm.loop.unroll.disable"}
|
|
; CHECK: [[META10]] = !{!"llvm.loop.isvectorized", i32 1}
|
|
; CHECK: [[META11]] = !{!"llvm.loop.unroll.runtime.disable"}
|
|
;.
|