Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/transcoding/fmax.ll

raw
1 ; RUN: llvm-as %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_KHR_fma -o %t.spv
3 ; RUN: spirv-val %t.spv
4 ; RUN: llvm-spirv %t.spv -to-text -o %t.spt
5 ; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
6 ; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.rev.ll
7 ; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM
8
9 ; Check enabling SPV_KHR_fma does not translate fmax to fma.
10
11 ; CHECK-SPIRV: ExtInst [[#]] [[#]] [[#]] fmax [[#]] [[#]]
12
13 ; CHECK-LLVM: %{{.*}} = call spir_func float @_Z4fmaxff(float %{{.*}}, float %{{.*}})
14
15 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
16 target triple = "spir64-unknown-unknown"
17
18 ; Case to test fmax translation via OCL builtins.
19 define spir_func float @test_fmax_ocl_scalar(float %a, float %b) {
20 entry:
21 %result = call spir_func float @_Z16__spirv_ocl_fmaxff(float %a, float %b)
22 ret float %result
23 }
24
25 declare spir_func float @_Z16__spirv_ocl_fmaxff(float, float)