reducible.hlsl 330 B

12345678910111213141516171819202122
  1. // RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
  2. // CHECK: !"llvm.loop.unroll.disable"
  3. uint u;
  4. float main(float a : A, int3 b : B) : SV_Target
  5. {
  6. float s = 0;
  7. /*
  8. [loop]
  9. for(int i = 0; i < b.x; i++) {
  10. s += a.x;
  11. if (s == 5)
  12. break;
  13. }
  14. */
  15. if (s > a)
  16. s -= u+b.x;
  17. else
  18. s += b.x+b.y;
  19. return s;
  20. }