]> gcc.gnu.org Git - gcc.git/commitdiff
[nvptx] Generalize bar.sync instruction
authorTom de Vries <tdevries@suse.de>
Wed, 19 Dec 2018 10:17:01 +0000 (10:17 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Wed, 19 Dec 2018 10:17:01 +0000 (10:17 +0000)
Allow the logical barrier operand of nvptx_barsync to be a register, and add a
thread count operand.

Build and reg-tested on x86_64 with nvptx accelerator.

2018-12-19  Tom de Vries  <tdevries@suse.de>

* config/nvptx/nvptx.md (nvptx_barsync): Add and handle operand.
* config/nvptx/nvptx.c (nvptx_wsync): Update call to gen_nvptx_barsync.

From-SVN: r267258

gcc/ChangeLog
gcc/config/nvptx/nvptx.c
gcc/config/nvptx/nvptx.md

index 9596b26860c925ad99f8b0f9bf8a9cbe6b49b207..a9f41a52f923aefc048116180636903ba9fdcbec 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-19  Tom de Vries  <tdevries@suse.de>
+
+       * config/nvptx/nvptx.md (nvptx_barsync): Add and handle operand.
+       * config/nvptx/nvptx.c (nvptx_wsync): Update call to gen_nvptx_barsync.
+
 2018-12-19  Tom de Vries  <tdevries@suse.de>
 
        * config/nvptx/nvptx.c (nvptx_single): Always pass false to
index a354811194c57064bbe0e67f6cb6cda0cec96aad..1ad3ba92caa0656daefab0029739db7ac82acf71 100644 (file)
@@ -3974,7 +3974,7 @@ nvptx_wpropagate (bool pre_p, bool is_call, basic_block block, rtx_insn *insn)
 static rtx
 nvptx_wsync (bool after)
 {
-  return gen_nvptx_barsync (GEN_INT (after));
+  return gen_nvptx_barsync (GEN_INT (after), GEN_INT (0));
 }
 
 #if WORKAROUND_PTXJIT_BUG
index ca00b1d8073d9fc0399c38e0ef537b78ce74e5d4..f1f6fe0c4043d2f810338526ee0195c2266e36fe 100644 (file)
   [(set_attr "atomic" "true")])
 
 (define_insn "nvptx_barsync"
-  [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "")]
+  [(unspec_volatile [(match_operand:SI 0 "nvptx_nonmemory_operand" "Ri")
+                    (match_operand:SI 1 "const_int_operand")]
                    UNSPECV_BARSYNC)]
   ""
-  "\\tbar.sync\\t%0;"
+  {
+    if (INTVAL (operands[1]) == 0)
+      return "\\tbar.sync\\t%0;";
+    else
+      return "\\tbar.sync\\t%0, %1;";
+  }
   [(set_attr "predicable" "false")])
 
 (define_expand "memory_barrier"
This page took 0.103877 seconds and 5 git commands to generate.