瀏覽代碼

Add test to make sure LoopUnswitchPass is disabled.

Xiang Li 8 年之前
父節點
當前提交
b213c2fc43
共有 1 個文件被更改,包括 21 次插入0 次删除
  1. 21 0
      tools/clang/test/CodeGenHLSL/shader-compat-suite/no_loop_unswitch.hlsl

+ 21 - 0
tools/clang/test/CodeGenHLSL/shader-compat-suite/no_loop_unswitch.hlsl

@@ -0,0 +1,21 @@
+// RUN: %dxc -T lib_6_1 %s | FileCheck %s
+
+// Make sure only 1 barrier.
+// CHECK: call void @dx.op.barrier(i32 80, i32 9)
+// CHECK-NOT: call void @dx.op.barrier(i32 80, i32 9)
+
+cbuffer X {
+  float x;
+  uint  n;
+}
+
+float test(uint t) {
+  float r = x;
+  for (uint i=0;i<n;i++) {
+    r++;
+    if (t>2)
+      r += 3;
+    GroupMemoryBarrierWithGroupSync();
+  }
+  return r;
+}