Skip to content

Commit de08c5f

Browse files
vmaksimosys-ce-bb
authored andcommitted
Support reverse translation of FPFastMathMode decoration for fcmp instruction (#3108)
This is a follow-up fix to #2506 Original commit: KhronosGroup/SPIRV-LLVM-Translator@7c149b86978f8fc
1 parent e06ee9a commit de08c5f

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

llvm-spirv/lib/SPIRV/SPIRVReader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,7 @@ Value *SPIRVToLLVM::transCmpInst(SPIRVValue *BV, BasicBlock *BB, Function *F) {
12281228
else if (BT->isTypeVectorOrScalarFloat())
12291229
Inst = Builder.CreateFCmp(CmpMap::rmap(OP), Op0, Op1);
12301230
assert(Inst && "not implemented");
1231+
applyFPFastMathModeDecorations(BV, static_cast<Instruction *>(Inst));
12311232
return Inst;
12321233
}
12331234

llvm-spirv/test/transcoding/fcmp.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
; RUN: llvm-spirv %t.bc --spirv-max-version=1.6 -o %t.spv
1010
; RUN: spirv-val %t.spv
1111
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.rev.ll
12-
; FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM-16
12+
; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM-16
1313

1414
; CHECK-SPIRV: 3 Name [[#r1:]] "r1"
1515
; CHECK-SPIRV: 3 Name [[#r2:]] "r2"

llvm-spirv/test/transcoding/fneg.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM
66

77
; RUN: llvm-spirv -spirv-text %t.bc --spirv-max-version=1.6
8-
; FileCheck < %t.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-16
8+
; RUN: FileCheck < %t.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-16
99
; RUN: llvm-spirv %t.bc --spirv-max-version=1.6 -o %t.spv
1010
; RUN: spirv-val %t.spv
1111
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM-16

0 commit comments

Comments
 (0)