Debian Codegraph @

llvm/test/CodeGen/SPIRV/half_extension.ll

raw
1 ;; #pragma OPENCL EXTENSION cl_khr_fp16 : enable
2 ;; half test()
3 ;; {
4 ;; half x = 0.1f;
5 ;; x += 2.0f;
6 ;; half y = x + x;
7 ;; return y;
8 ;; }
9
10 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
11
12 ; CHECK-SPIRV-DAG: OpCapability Float16Buffer
13 ; CHECK-SPIRV-DAG: OpCapability Float16
14
15 define spir_func half @test() {
16 entry:
17 %x = alloca half, align 2
18 %y = alloca half, align 2
19 store half 0xH2E66, ptr %x, align 2
20 %0 = load half, ptr %x, align 2
21 %conv = fpext half %0 to float
22 %add = fadd float %conv, 2.000000e+00
23 %conv1 = fptrunc float %add to half
24 store half %conv1, ptr %x, align 2
25 %1 = load half, ptr %x, align 2
26 %2 = load half, ptr %x, align 2
27 %add2 = fadd half %1, %2
28 store half %add2, ptr %y, align 2
29 %3 = load half, ptr %y, align 2
30 ret half %3
31 }