File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -4631,7 +4631,7 @@ SPIRVValue *LLVMToSPIRVBase::transDirectCallInst(CallInst *CI,
46314631 BM->addExtension (
46324632 ExtensionID::SPV_EXT_relaxed_printf_string_address_space);
46334633 }
4634- } else if (DemangledName. find ( " __spirv_ocl_fma " ) != StringRef::npos ) {
4634+ } else if (DemangledName == " __spirv_ocl_fma " ) {
46354635 if (BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_fma))
46364636 return BM->addInstTemplate (OpFmaKHR,
46374637 BM->getIds (transValue (getArguments (CI), BB)),
Original file line number Diff line number Diff line change 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 )
You can’t perform that action at this time.
0 commit comments