+2015-12-02 Nathan Sidwell <nathan@acm.org>
+
+ * config/nvptx/nvptx.c (enum nvptx_shuffle_kind): New. Absorb
+ SHUFFLE defines.
+ (nvptx_gen_shuffle, nvptx_print_operand, nvptx_expand_shuffle): Adjust.
+
2015-12-02 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
/* This file should be included last. */
#include "target-def.h"
-#define SHUFFLE_UP 0
-#define SHUFFLE_DOWN 1
-#define SHUFFLE_BFLY 2
-#define SHUFFLE_IDX 3
+/* The kind of shuffe instruction. */
+enum nvptx_shuffle_kind
+{
+ SHUFFLE_UP,
+ SHUFFLE_DOWN,
+ SHUFFLE_BFLY,
+ SHUFFLE_IDX,
+ SHUFFLE_MAX
+};
/* Record the function decls we've written, and the libfuncs and function
decls corresponding to them. */
across the vectors of a single warp. */
static rtx
-nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, unsigned kind)
+nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind)
{
rtx res;
case 'S':
{
- unsigned kind = UINTVAL (x);
+ nvptx_shuffle_kind kind = (nvptx_shuffle_kind) UINTVAL (x);
+ /* Same order as nvptx_shuffle_kind. */
static const char *const kinds[] =
- {"up", "down", "bfly", "idx"};
- fprintf (file, ".%s", kinds[kind]);
+ {".up", ".down", ".bfly", ".idx"};
+ fputs (kinds[kind], file);
}
break;
if (!REG_P (idx) && GET_CODE (idx) != CONST_INT)
idx = copy_to_mode_reg (SImode, idx);
- rtx pat = nvptx_gen_shuffle (target, src, idx, INTVAL (op));
+ rtx pat = nvptx_gen_shuffle (target, src, idx,
+ (nvptx_shuffle_kind) INTVAL (op));
if (pat)
emit_insn (pat);