Skip to content

Commit 38944e1

Browse files
committed
FEAT:
Add support for the intrinsic @llvm.fptosi.sat.* and @llvm.fptoui.sat.* - add legalizer for G_FPTOSI_SAT and G_FPTOUI_SAT - add instructionSelector for G_FPTOSI_SAT and G_FPTOUI_SAT - add function to add saturatedConversion decoration to the intrinsic
1 parent a278b28 commit 38944e1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,24 @@ static void createSaturatedConversionDecoration(Instruction *I,
13671367
createDecorationIntrinsic(I, SaturatedConversionNode, B);
13681368
}
13691369

1370+
static void addSaturatedDecorationToIntrinsic(Instruction *I, IRBuilder<> &B) {
1371+
if (auto *CI = dyn_cast<CallInst>(I)) {
1372+
if (Function *Fu = CI->getCalledFunction()) {
1373+
if (Fu->isIntrinsic()) {
1374+
unsigned const int IntrinsicId = Fu->getIntrinsicID();
1375+
switch (IntrinsicId) {
1376+
case Intrinsic::fptosi_sat:
1377+
case Intrinsic::fptoui_sat:
1378+
createSaturatedConversionDecoration(I, B);
1379+
break;
1380+
default:
1381+
break;
1382+
}
1383+
}
1384+
}
1385+
}
1386+
}
1387+
13701388
Instruction *SPIRVEmitIntrinsics::visitCallInst(CallInst &Call) {
13711389
if (!Call.isInlineAsm())
13721390
return &Call;

0 commit comments

Comments
 (0)