shift.hlsl 711 B

12345678910111213141516171819202122232425262728
  1. // RUN: %dxc -E main -T ps_6_0 -not_use_legacy_cbuf_load %s | FileCheck %s
  2. // The shift for hlsl only use the LSB 5 bits (0-31 range) of src1 for int/uint.
  3. // CHECK: shl i32 {{.*}}, 18
  4. // CHECK: and i32 {{.*}}, 31
  5. // CHECK: ashr
  6. // CHECK: and i32 {{.*}}, 31
  7. // CHECK: lshr
  8. // The shift for hlsl only use the LSB 6 bits (0-63 range) of src1 for int64_t/uint64_t.
  9. // CHECK: shl i64 {{.*}}, 4
  10. // CHECK: and i64 {{.*}}, 63
  11. // CHECK: lshr
  12. // CHECK: and i64 {{.*}}, 63
  13. // CHECK: ashr
  14. uint64_t u;
  15. int64_t i;
  16. float4 main(float4 a : A, int b:B, int c:C, uint d:D) : SV_TARGET {
  17. int e = b << 50;
  18. e = e >> c;
  19. uint f = d >> e;
  20. uint64_t x = u << 68;
  21. x = x >> c;
  22. int64_t z = i >> d;
  23. return a + f + x + z;
  24. }