@@ -2428,7 +2428,44 @@ class SYCLGen : public SYCLGenBase {
2428
2428
}
2429
2429
}
2430
2430
2431
+ bool HandleCvtVec (const InlineAsmInstruction *Inst) {
2432
+
2433
+ if (emitStmt (Inst->getOutputOperand ()))
2434
+ return SYCLGenError ();
2435
+ std::string Op;
2436
+ if (tryEmitStmt (Op, Inst->getInputOperand (0 )))
2437
+ return SYCLGenError ();
2438
+ OS () << " = " ;
2439
+ std::string FormatTemp =
2440
+ " (sycl::ushort2(sycl::vec<float, 1>({0}).convert<sycl::half, "
2441
+ " sycl::rounding_mode::rte>().as<sycl::vec<uint16_t, 1>>().x(),"
2442
+ " sycl::vec<float, 1>({1}).convert<sycl::half, "
2443
+ " sycl::rounding_mode::rte>().as<sycl::vec<uint16_t, 1>>().x()))"
2444
+ " .as<sycl::vec<int, 1>>().x()" ;
2445
+
2446
+ std::string InputOp[2 ];
2447
+ for (unsigned I = 0 ; I < Inst->getNumInputOperands (); ++I) {
2448
+ if (tryEmitStmt (InputOp[I], Inst->getInputOperand (I)))
2449
+ return SYCLGenError ();
2450
+ if (Inst->hasAttr (InstAttr::sat))
2451
+ InputOp[I] = Cast (Inst->getType (0 ), Inst->getInputOperand (I)->getType (),
2452
+ InputOp[I]);
2453
+ }
2454
+
2455
+ OS () << llvm::formatv (FormatTemp.c_str (), InputOp[1 ], InputOp[0 ]);
2456
+
2457
+ endstmt ();
2458
+ return SYCLGenSuccess ();
2459
+ }
2460
+
2431
2461
bool handle_cvt (const InlineAsmInstruction *Inst) override {
2462
+
2463
+ if (Inst->getNumInputOperands () == 2 && Inst->getNumTypes () == 2 &&
2464
+ isa<InlineAsmBuiltinType>(Inst->getType (0 )) &&
2465
+ isa<InlineAsmBuiltinType>(Inst->getType (1 ))) {
2466
+ return HandleCvtVec (Inst);
2467
+ }
2468
+
2432
2469
if (Inst->getNumInputOperands () != 1 || Inst->getNumTypes () != 2 ||
2433
2470
!isa<InlineAsmBuiltinType>(Inst->getType (0 )) ||
2434
2471
!isa<InlineAsmBuiltinType>(Inst->getType (1 )))
0 commit comments