texsurf-queries.ll 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s --check-prefix=SM20
  2. ; RUN: llc < %s -march=nvptx -mcpu=sm_30 | FileCheck %s --check-prefix=SM30
  3. target triple = "nvptx-unknown-cuda"
  4. @tex0 = internal addrspace(1) global i64 0, align 8
  5. @surf0 = internal addrspace(1) global i64 0, align 8
  6. declare i32 @llvm.nvvm.txq.width(i64)
  7. declare i32 @llvm.nvvm.txq.height(i64)
  8. declare i32 @llvm.nvvm.suq.width(i64)
  9. declare i32 @llvm.nvvm.suq.height(i64)
  10. declare i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)*)
  11. ; SM20-LABEL: @t0
  12. ; SM30-LABEL: @t0
  13. define i32 @t0(i64 %texHandle) {
  14. ; SM20: txq.width.b32
  15. ; SM30: txq.width.b32
  16. %width = tail call i32 @llvm.nvvm.txq.width(i64 %texHandle)
  17. ret i32 %width
  18. }
  19. ; SM20-LABEL: @t1
  20. ; SM30-LABEL: @t1
  21. define i32 @t1() {
  22. ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], tex0
  23. %texHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @tex0)
  24. ; SM20: txq.width.b32 %r{{[0-9]+}}, [tex0]
  25. ; SM30: txq.width.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
  26. %width = tail call i32 @llvm.nvvm.txq.width(i64 %texHandle)
  27. ret i32 %width
  28. }
  29. ; SM20-LABEL: @t2
  30. ; SM30-LABEL: @t2
  31. define i32 @t2(i64 %texHandle) {
  32. ; SM20: txq.height.b32
  33. ; SM30: txq.height.b32
  34. %height = tail call i32 @llvm.nvvm.txq.height(i64 %texHandle)
  35. ret i32 %height
  36. }
  37. ; SM20-LABEL: @t3
  38. ; SM30-LABEL: @t3
  39. define i32 @t3() {
  40. ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], tex0
  41. %texHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @tex0)
  42. ; SM20: txq.height.b32 %r{{[0-9]+}}, [tex0]
  43. ; SM30: txq.height.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
  44. %height = tail call i32 @llvm.nvvm.txq.height(i64 %texHandle)
  45. ret i32 %height
  46. }
  47. ; SM20-LABEL: @s0
  48. ; SM30-LABEL: @s0
  49. define i32 @s0(i64 %surfHandle) {
  50. ; SM20: suq.width.b32
  51. ; SM30: suq.width.b32
  52. %width = tail call i32 @llvm.nvvm.suq.width(i64 %surfHandle)
  53. ret i32 %width
  54. }
  55. ; SM20-LABEL: @s1
  56. ; SM30-LABEL: @s1
  57. define i32 @s1() {
  58. ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], surf0
  59. %surfHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @surf0)
  60. ; SM20: suq.width.b32 %r{{[0-9]+}}, [surf0]
  61. ; SM30: suq.width.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
  62. %width = tail call i32 @llvm.nvvm.suq.width(i64 %surfHandle)
  63. ret i32 %width
  64. }
  65. ; SM20-LABEL: @s2
  66. ; SM30-LABEL: @s2
  67. define i32 @s2(i64 %surfHandle) {
  68. ; SM20: suq.height.b32
  69. ; SM30: suq.height.b32
  70. %height = tail call i32 @llvm.nvvm.suq.height(i64 %surfHandle)
  71. ret i32 %height
  72. }
  73. ; SM20-LABEL: @s3
  74. ; SM30-LABEL: @s3
  75. define i32 @s3() {
  76. ; SM30: mov.u64 %rd[[HANDLE:[0-9]+]], surf0
  77. %surfHandle = tail call i64 @llvm.nvvm.texsurf.handle.internal.p1i64(i64 addrspace(1)* @surf0)
  78. ; SM20: suq.height.b32 %r{{[0-9]+}}, [surf0]
  79. ; SM30: suq.height.b32 %r{{[0-9]+}}, [%rd[[HANDLE:[0-9]+]]]
  80. %height = tail call i32 @llvm.nvvm.suq.height(i64 %surfHandle)
  81. ret i32 %height
  82. }
  83. !nvvm.annotations = !{!1, !2}
  84. !1 = !{i64 addrspace(1)* @tex0, !"texture", i32 1}
  85. !2 = !{i64 addrspace(1)* @surf0, !"surface", i32 1}