Debian Codegraph @

IGC/ocloc_tests/SPIRV-extensions/SPV_INTEL_mini_floats/FP4/ConvertFP16ToInt4_ImmediateInput.ll

raw
1 ;=========================== begin_copyright_notice ============================
2 ;
3 ; Copyright (C) 2026 Intel Corporation
4 ;
5 ; SPDX-License-Identifier: MIT
6 ;
7 ;============================ end_copyright_notice =============================
8
9 ; REQUIRES: llvm-spirv, cri-supported
10 ; RUN: llvm-as %s -o %t.bc
11 ; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_INTEL_int4
12 ; RUN: ocloc compile -spirv_input -file %t.spv -device cri -options "-igc_opts 'ForceOCLSIMDWidth=32,DumpVISAASMToConsole=1,AddVISADumpDeclarationsToEnd=1'" | FileCheck %s
13
14 ; Test if conversion opcodes are present in spirv disassembly
15 ; RUN: llvm-spirv --to-text %t.spv -o %t.spt
16 ; RUN: cat %t.spt | FileCheck %s -check-prefix=CHECK-SPV
17 ; CHECK-SPV: ConvertFToS
18
19 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024"
20 target triple = "spir64-unknown-unknown"
21
22 declare spir_func i64 @_Z33__spirv_BuiltInGlobalInvocationIdi(i32)
23
24 ;
25 ; Special case test with immediate inputs
26 ;
27 define spir_kernel void @FP16_to_Int4_vector4_immediate_input(<4 x i4> addrspace(1)* %output) {
28 ; CHECK-LABEL: .kernel "FP16_to_Int4_vector4_immediate_input"
29 ; CHECK-DAG: dnscl.hftoint4.mode0.rne (M1_NM, 1) [[DST:[A-z0-9]*]].0 [[INPUT0:[A-z0-9]*]].0 [[INPUT1:[A-z0-9]*]].0 %null.0
30 ; CHECK-DAG: mov (M1_NM, 1) [[INPUT0]](0,0)<1> 0x3c003800:ud
31 ; CHECK-DAG: mov (M1_NM, 1) [[INPUT1]](0,0)<1> 0x41333e00:ud
32 ; CHECK-DAG: // .decl [[INPUT0]] v_type=G type=ud num_elts=1
33 ; CHECK-DAG: // .decl [[INPUT1]] v_type=G type=ud num_elts=1
34 ; CHECK-DAG: // .decl [[DST]] v_type=G type=ud num_elts=1
35 %gid = call spir_func i64 @_Z33__spirv_BuiltInGlobalInvocationIdi(i32 0)
36 %outputAddr = getelementptr <4 x i4>, <4 x i4> addrspace(1)* %output, i64 %gid
37
38 %conv = call <4 x i4> @_Z38__builtin_spirv_ConvertFP16ToInt4INTELDv4_Dh(<4 x half> <half 0xH3800, half 0xH3C00, half 0xH3E00, half 0xH4133>)
39
40 store <4 x i4> %conv, <4 x i4> addrspace(1)* %outputAddr, align 2
41 ret void
42 }
43 declare dso_local spir_func <4 x i4> @_Z38__builtin_spirv_ConvertFP16ToInt4INTELDv4_Dh(<4 x half>)