[Beignet] [PATCH 3/3] add llvm intrinsic call translate.

Song, Ruiling ruiling.song at intel.com
Thu Jan 15 00:00:27 PST 2015


> +          case Intrinsic::trunc:
> +          {
> +            Type *llvmDstType = I.getType();
> +            Type *llvmSrcType = I.getOperand(0)->getType();
> +            ir::Type dstType = getType(ctx, llvmDstType);
> +            ir::Type srcType = getType(ctx, llvmSrcType);
> +            GBE_ASSERT(srcType == dstType);
> +
> +            const ir::Register tmp = ctx.reg(getFamily(ir::TYPE_S32));
> +            const ir::Register dst = this->getRegister(&I);
> +            const ir::Register src = this->getRegister(I.getOperand(0));
> +            ctx.CVT(ir::TYPE_S32, srcType, tmp, src);
> +            ctx.CVT(dstType, ir::TYPE_S32, dst, tmp);
Why do we need to convert to TYPE_S32 to convert from TYPE_S32 to dstType?



More information about the Beignet mailing list