Пример #1
0
        /// <summary cref="IValueVisitor.Visit(WarpShuffle)"/>
        public void Visit(WarpShuffle shuffle)
        {
            if (!CLInstructions.TryGetShuffleOperation(
                    Backend.Vendor,
                    shuffle.Kind,
                    out string operation))
            {
                throw new InvalidCodeGenerationException();
            }

            var source = Load(shuffle.Variable);
            var origin = Load(shuffle.Origin);
            var target = Allocate(shuffle);

            using (var statement = BeginStatement(target))
            {
                statement.AppendCommand(operation);
                statement.BeginArguments();

                statement.AppendArgument(source);
                // TODO: create a generic version that does not need this switch
                switch (shuffle.Kind)
                {
                case ShuffleKind.Down:
                case ShuffleKind.Up:
                    statement.AppendArgument(source);
                    break;
                }
                statement.AppendArgument(origin);

                statement.EndArguments();
            }
        }
Пример #2
0
 /// <summary>
 /// Lowers warp shuffles.
 /// </summary>
 private static void Lower(
     SSARewriterContext <FieldRef> context,
     LoweringData _,
     WarpShuffle value) =>
 LowerThreadValue <
     WarpShuffle,
     LowerThreadIntrinsics.WarpShuffleLowering>(
     context,
     value.Type as StructureType,
     value);
Пример #3
0
 /// <summary cref="IValueVisitor.Visit(WarpShuffle)"/>
 public void Visit(WarpShuffle shuffle) =>
 CodeGenerator.GenerateCode(shuffle);