Skip to content

Commit 7c149b8

Browse files
authored
[SPIR-V 1.6] Support reverse translation of FPFastMathMode decoration for fcmp instruction (#3108)
This is a follow-up fix to #2506
1 parent f646fce commit 7c149b8

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

lib/SPIRV/SPIRVReader.cpp

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

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"

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)