Files
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

111 lines
4.5 KiB
LLVM

; RUN: llvm-spirv -spirv-text %s -o %t.spt
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv -to-binary %t.spt -o %t.spv
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM "--implicit-check-not={{(shl|lshr|or|and) i(16|32|64)}}"
; RUN: %if spirv-backend %{ llc -O0 -mtriple=spirv64-unknown-unknown -filetype=obj %s -o %t.llc.spv %}
; RUN: %if spirv-backend %{ llvm-spirv -r %t.llc.spv -o %t.llc.rev.bc %}
; RUN: %if spirv-backend %{ llvm-dis %t.llc.rev.bc -o %t.llc.rev.ll %}
; RUN: %if spirv-backend %{ FileCheck %s --check-prefix=CHECK-LLVM < %t.llc.rev.ll %}
; CHECK-SPIRV: Name [[#FuncNameInt16:]] "spirv.llvm_bswap_i16"
; CHECK-SPIRV: Name [[#FuncNameInt32:]] "spirv.llvm_bswap_i32"
; CHECK-SPIRV: Name [[#FuncNameInt64:]] "spirv.llvm_bswap_i64"
; CHECK-SPIRV: TypeInt [[#TypeInt32:]] 32 0
; CHECK-SPIRV: TypeInt [[#TypeInt16:]] 16 0
; CHECK-SPIRV: TypeInt [[#TypeInt64:]] 64 0
; CHECK-SPIRV: Function [[#TypeInt16]] [[#FuncNameInt16]]
; CHECK-SPIRV: FunctionParameter [[#TypeInt16]] [[#FuncParameter:]]
; CHECK-SPIRV: ShiftLeftLogical [[#TypeInt16]] [[#]] [[#FuncParameter]]
; CHECK-SPIRV: ShiftRightLogical [[#TypeInt16]] [[#]] [[#FuncParameter]]
; CHECK-SPIRV: BitwiseOr [[#TypeInt16]] [[#RetVal:]]
; CHECK-SPIRV: ReturnValue [[#RetVal]]
; CHECK-SPIRV: FunctionEnd
; CHECK-SPIRV: Function [[#TypeInt32]] [[#FuncNameInt32]]
; CHECK-SPIRV: FunctionParameter [[#TypeInt32]] [[#FuncParameter:]]
; CHECK-SPIRV-COUNT-2: ShiftLeftLogical [[#TypeInt32]] [[#]] [[#FuncParameter]]
; CHECK-SPIRV-COUNT-2: ShiftRightLogical [[#TypeInt32]] [[#]] [[#FuncParameter]]
; CHECK-SPIRV-COUNT-2: BitwiseAnd [[#TypeInt32]]
; CHECK-SPIRV-COUNT-2: BitwiseOr [[#TypeInt32]]
; CHECK-SPIRV: BitwiseOr [[#TypeInt32]] [[#RetVal:]]
; CHECK-SPIRV: ReturnValue [[#RetVal:]]
; CHECK-SPIRV: FunctionEnd
; CHECK-SPIRV: Function [[#TypeInt64]] [[#FuncNameInt64]]
; CHECK-SPIRV: FunctionParameter [[#TypeInt64]] [[#FuncParameter:]]
; CHECK-SPIRV-COUNT-4: ShiftLeftLogical [[#TypeInt64]] [[#]] [[#FuncParameter]] [[#]]
; CHECK-SPIRV-COUNT-4: ShiftRightLogical [[#TypeInt64]] [[#]] [[#FuncParameter]] [[#]]
; CHECK-SPIRV-COUNT-6: BitwiseAnd [[#TypeInt64]]
; CHECK-SPIRV-COUNT-6: BitwiseOr [[#TypeInt64]]
; CHECK-SPIRV: BitwiseOr [[#TypeInt64]] [[#RetVal:]]
; CHECK-SPIRV: ReturnValue [[#RetVal]]
; CHECK-SPIRV: FunctionEnd
; CHECK-LLVM-COUNT-2: call i16 @llvm.bswap.i16(i16
; CHECK-LLVM: call i32 @llvm.bswap.i32(i32
; CHECK-LLVM: call i64 @llvm.bswap.i64(i64
; ModuleID = 'source.cpp'
source_filename = "source.cpp"
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
target triple = "spir64"
; Function Attrs: mustprogress noinline norecurse nounwind optnone
define dso_local i32 @main() #0 {
entry:
%retval = alloca i32, align 4
%a = alloca i16, align 2
%b = alloca i16, align 2
%h = alloca i16, align 2
%i = alloca i16, align 2
%c = alloca i32, align 4
%d = alloca i32, align 4
%e = alloca i64, align 8
%f = alloca i64, align 8
store i32 0, ptr %retval, align 4
store i16 258, ptr %a, align 2
%0 = load i16, ptr %a, align 2
%1 = call i16 @llvm.bswap.i16(i16 %0)
store i16 %1, ptr %b, align 2
store i16 234, ptr %h, align 2
%2 = load i16, ptr %h, align 2
%3 = call i16 @llvm.bswap.i16(i16 %2)
store i16 %3, ptr %i, align 2
store i32 566, ptr %c, align 4
%4 = load i32, ptr %c, align 4
%5 = call i32 @llvm.bswap.i32(i32 %4)
store i32 %5, ptr %d, align 4
store i64 12587, ptr %e, align 8
%6 = load i64, ptr %e, align 8
%7 = call i64 @llvm.bswap.i64(i64 %6)
store i64 %7, ptr %f, align 8
ret i32 0
}
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare i16 @llvm.bswap.i16(i16) #1
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare i32 @llvm.bswap.i32(i32) #1
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare i64 @llvm.bswap.i64(i64) #1
attributes #0 = { mustprogress noinline norecurse nounwind optnone "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
!llvm.module.flags = !{!0, !1}
!opencl.used.extensions = !{!2}
!opencl.used.optional.core.features = !{!2}
!opencl.compiler.options = !{!2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"frame-pointer", i32 2}
!2 = !{}
!3 = !{!"Compiler"}