Skip to content

Commit abeb7d0

Browse files
authored
[Backport to 17] [SPIR-V 1.6] Reverse translation of FPFastMathMode ... (#3112)
... decoration for `fcmp` instruction.
1 parent d3416f0 commit abeb7d0

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
@@ -1210,6 +1210,7 @@ Value *SPIRVToLLVM::transCmpInst(SPIRVValue *BV, BasicBlock *BB, Function *F) {
12101210
else if (BT->isTypeVectorOrScalarFloat())
12111211
Inst = Builder.CreateFCmp(CmpMap::rmap(OP), Op0, Op1);
12121212
assert(Inst && "not implemented");
1213+
applyFPFastMathModeDecorations(BV, static_cast<Instruction *>(Inst));
12131214
return Inst;
12141215
}
12151216

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 -emit-opaque-pointers %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)