nvptx.c (nvptx_gen_shuffle): Add support for QImode and HImode registers.
authorCesar Philippidis <cesar@codesourcery.com>
Mon, 22 Feb 2016 16:28:25 +0000 (08:28 -0800)
committerCesar Philippidis <cesar@gcc.gnu.org>
Mon, 22 Feb 2016 16:28:25 +0000 (08:28 -0800)
gcc/
* config/nvptx/nvptx.c (nvptx_gen_shuffle): Add support for QImode
and HImode registers.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/vprop.c: New test.

From-SVN: r233607

gcc/ChangeLog
gcc/config/nvptx/nvptx.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.oacc-c-c++-common/vprop.c [new file with mode: 0644]

index a352259a2a0ee4b5f1e6165bfe82e90589d46772..a76236eb901c145711e9c290759e8ef6a36e20f4 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-22  Cesar Philippidis  <cesar@codesourcery.com>
+
+       * config/nvptx/nvptx.c (nvptx_gen_shuffle): Add support for QImode
+       and HImode registers.
+
 2016-02-22  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/69882
index a955c041aedc151db8870d4e5d27397e419562f3..33b495ffcd94b792c0f2c82184d52c533dfa813c 100644 (file)
@@ -1306,6 +1306,20 @@ nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind)
        end_sequence ();
       }
       break;
+    case QImode:
+    case HImode:
+      {
+       rtx tmp = gen_reg_rtx (SImode);
+
+       start_sequence ();
+       emit_insn (gen_rtx_SET (tmp, gen_rtx_fmt_e (ZERO_EXTEND, SImode, src)));
+       emit_insn (nvptx_gen_shuffle (tmp, tmp, idx, kind));
+       emit_insn (gen_rtx_SET (dst, gen_rtx_fmt_e (TRUNCATE, GET_MODE (dst),
+                                                   tmp)));
+       res = get_insns ();
+       end_sequence ();
+      }
+      break;
       
     default:
       gcc_unreachable ();
index 732c6c3162b0c9f75b0f5b76714473baade438f8..1394126f98fe6c26947d46e736d503650277834e 100644 (file)
@@ -1,3 +1,7 @@
+2016-02-22  Cesar Philippidis  <cesar@codesourcery.com>
+
+       * testsuite/libgomp.oacc-c-c++-common/vprop.c: New test.
+
 2016-02-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR driver/69805
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/vprop.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/vprop.c
new file mode 100644 (file)
index 0000000..a9b63dc
--- /dev/null
@@ -0,0 +1,34 @@
+#include <assert.h>
+
+#define test(type)                             \
+void                                           \
+test_##type ()                                 \
+{                                              \
+  type b[100];                                 \
+  type i, j, x = -1, y = -1;                   \
+                                               \
+  _Pragma("acc parallel loop copyout (b)")     \
+  for (j = 0; j > -5; j--)                     \
+    {                                          \
+      type c = x+y;                             \
+      _Pragma("acc loop vector")               \
+      for (i = 0; i < 20; i++)                 \
+       b[-j*20 + i] = c;                       \
+      b[5-j] = c;                               \
+    }                                          \
+                                               \
+  for (i = 0; i < 100; i++)                    \
+    assert (b[i] == -2);                       \
+}
+
+test(char)
+test(short)
+
+int
+main ()
+{
+  test_char ();
+  test_short ();
+
+  return 0;
+}