/// <summary cref="IValueVisitor.Visit(IntAsFloatCast)"/>
        public void Visit(IntAsFloatCast value)
        {
            var source         = LoadIntrinsic(value.Value);
            var targetRegister = AllocateIntrinsic(value);

            using (var statement = BeginStatement(targetRegister))
            {
                statement.AppendCommand(CLInstructions.IntAsFloat);
                statement.BeginArguments();
                statement.AppendArgument(source);
                statement.EndArguments();
            }
        }
Example #2
0
        /// <summary cref="IBackendCodeGenerator.GenerateCode(IntAsFloatCast)"/>
        public void GenerateCode(IntAsFloatCast value)
        {
            var source = Load(value.Value);
            var target = Allocate(value);

            using var statement = BeginStatement(target);
            statement.AppendCommand(
                value.BasicValueType == BasicValueType.Float64 ?
                CLInstructions.LongAsDouble :
                CLInstructions.IntAsFloat);
            statement.BeginArguments();
            statement.AppendArgument(source);
            statement.EndArguments();
        }
Example #3
0
        /// <summary cref="IValueVisitor.Visit(IntAsFloatCast)"/>
        public void Visit(IntAsFloatCast value)
        {
            var source = LoadPrimitive(value.Value);

            Debug.Assert(
                source.Kind == PTXRegisterKind.Int32 ||
                source.Kind == PTXRegisterKind.Int64);

            var targetRegister = AllocatePrimitive(value);

            Debug.Assert(
                targetRegister.Kind == PTXRegisterKind.Float32 ||
                targetRegister.Kind == PTXRegisterKind.Float64);

            Move(source, targetRegister);
        }
Example #4
0
        /// <summary cref="IBackendCodeGenerator.GenerateCode(IntAsFloatCast)"/>
        public void GenerateCode(IntAsFloatCast value)
        {
            var source = LoadHardware(value.Value);

            Debug.Assert(
                source.Kind == PTXRegisterKind.Int32 ||
                source.Kind == PTXRegisterKind.Int64);

            var targetRegister = AllocateHardware(value);

            Debug.Assert(
                targetRegister.Kind == PTXRegisterKind.Float32 ||
                targetRegister.Kind == PTXRegisterKind.Float64);

            Move(source, targetRegister);
        }
Example #5
0
        /// <summary cref="IBackendCodeGenerator.GenerateCode(IntAsFloatCast)"/>
        public void GenerateCode(IntAsFloatCast value)
        {
            var source = LoadHardware(value.Value);

            if (source.Kind == PTXRegisterKind.Int16)
            {
                // Reuse the register, since int16 and fp16 registers are the same
                Bind(value, source);
            }
            else
            {
                Debug.Assert(
                    source.Kind == PTXRegisterKind.Int32 ||
                    source.Kind == PTXRegisterKind.Int64);

                var targetRegister = AllocateHardware(value);
                Debug.Assert(
                    targetRegister.Kind == PTXRegisterKind.Float32 ||
                    targetRegister.Kind == PTXRegisterKind.Float64);

                Move(source, targetRegister);
            }
        }
Example #6
0
 public void Visit(IntAsFloatCast value)
 {
 }
Example #7
0
 /// <summary cref="IValueVisitor.Visit(IntAsFloatCast)"/>
 public void Visit(IntAsFloatCast value) =>
 CodeGenerator.GenerateCode(value);