Files
TheRock/compiler/spirv-llvm-translator/test/llvm-intrinsics/sadd.with.overflow.ll
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

89 lines
3.3 KiB
LLVM

; The test is generated by Clang from the following source:
;
; void foo32(int a, int b, int *c) {
; *c = a + b;
; }
;
; void foo64(long a, long b, long *c) {
; *c = a + b;
; }
;
; With the following options:
; -emit-llvm -fno-discard-value-names -O2 -g0 -ftrapv -target spir
; RUN: llvm-as < %s -o %t.bc
; RUN: llvm-spirv -s %t.bc -o - | llvm-dis -o - | FileCheck %s
; CHECK: call { i32, i1 } @llvm_sadd_with_overflow_i32{{.*}} !nosanitize !2
; CHECK-NOT: call { i32, i1 } @llvm.sadd.with.overflow.i32
; CHECK: call { i64, i1 } @llvm_sadd_with_overflow_i64{{.*}} !nosanitize !2
; CHECK-NOT: call { i64, i1 } @llvm.sadd.with.overflow.i64
; CHECK-NOT: call { i16, i1 } @llvm_sadd_with_overflow_i16
target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir"
; Function Attrs: nounwind
define dso_local spir_func void @foo32(i32 %a, i32 %b, ptr captures(none) %c) local_unnamed_addr #0 {
entry:
%0 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %a, i32 %b), !nosanitize !2
%1 = extractvalue { i32, i1 } %0, 1, !nosanitize !2
br i1 %1, label %trap, label %cont, !nosanitize !2
trap: ; preds = %entry
tail call void @llvm.trap() #3, !nosanitize !2
unreachable, !nosanitize !2
cont: ; preds = %entry
%2 = extractvalue { i32, i1 } %0, 0, !nosanitize !2
store i32 %2, ptr %c, align 4, !tbaa !3
ret void
}
; Function Attrs: nounwind readnone speculatable willreturn
declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32) #1
; Function Attrs: cold noreturn nounwind
declare void @llvm.trap() #2
; Function Attrs: nounwind
define dso_local spir_func void @foo64(i64 %a, i64 %b, ptr captures(none) %c) local_unnamed_addr #0 {
entry:
%0 = tail call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %a, i64 %b), !nosanitize !2
%1 = extractvalue { i64, i1 } %0, 1, !nosanitize !2
br i1 %1, label %trap, label %cont, !nosanitize !2
trap: ; preds = %entry
tail call void @llvm.trap() #3, !nosanitize !2
unreachable, !nosanitize !2
cont: ; preds = %entry
%2 = extractvalue { i64, i1 } %0, 0, !nosanitize !2
store i64 %2, ptr %c, align 8, !tbaa !7
ret void
}
; Function Attrs: nounwind readnone speculatable willreturn
declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64) #1
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind readnone speculatable willreturn }
attributes #2 = { cold noreturn nounwind }
attributes #3 = { noreturn nounwind }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 576fa5a50c8509977835031d190f8906e1dbb075)"}
!2 = !{}
!3 = !{!4, !4, i64 0}
!4 = !{!"int", !5, i64 0}
!5 = !{!"omnipotent char", !6, i64 0}
!6 = !{!"Simple C/C++ TBAA"}
!7 = !{!8, !8, i64 0}
!8 = !{!"long", !5, i64 0}