Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. The current implementation generates this:
  2.  
  3. define void @main([9 x <16 x i8>] addrspace(2)* byval, [17 x <16 x i8>] addrspace(2)* byval, [17 x <4 x i32>] addrspace(2)* byval, [34 x <8 x i32>] addrsp
  4. main_body:
  5. %ptr = getelementptr [17 x <16 x i8>], [17 x <16 x i8>] addrspace(2)* %1, i64 0, i64 0
  6. %l = load <16 x i8>, <16 x i8> addrspace(2)* %ptr, align 16, !tbaa !0
  7. %c = call float @llvm.SI.load.const(<16 x i8> %l, i32 0)
  8. %p = call i32 @llvm.SI.packf16(float %c, float 0.000000e+00)
  9. %v1 = bitcast i32 %p to float
  10. %z = call i32 @llvm.SI.packf16(float 0.000000e+00, float 0.000000e+00)
  11. %v2 = bitcast i32 %z to float
  12. call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 1, float %v1, float %v2, float %v1, float %v2)
  13. ret void
  14. }
  15.  
  16. ; Function Attrs: nounwind readnone
  17. declare float @llvm.SI.load.const(<16 x i8>, i32) #1
  18.  
  19. ; Function Attrs: nounwind readnone
  20. declare i32 @llvm.SI.packf16(float, float) #1
  21.  
  22. declare void @llvm.SI.export(i32, i32, i32, i32, i32, float, float, float, float)
  23.  
  24. attributes #0 = { "ShaderType"="0" "enable-no-nans-fp-math"="true" "unsafe-fp-math"="true" }
  25. attributes #1 = { nounwind readnone }
  26.  
  27. !0 = !{!"const", null, i32 1}
  28.  
  29.  
  30.  
  31. My patch should generate this:
  32.  
  33. define void @main(i32 inreg, i32 inreg, i32 inreg, i32 inreg, float inreg, i32 inreg, <2 x i32>, <2 x i32>, <2 x i32>, <3 x i32>, <2 x i32>, <2 x i32>, <2
  34. main_body:
  35. %22 = zext i32 %1 to i64
  36. %23 = inttoptr i64 %22 to [17 x <16 x i8>] addrspace(2)*
  37. %ptr = getelementptr [17 x <16 x i8>], [17 x <16 x i8>] addrspace(2)* %23, i64 0, i64 0
  38. %l = load <16 x i8>, <16 x i8> addrspace(2)* %ptr, align 16, !tbaa !0
  39. %c = call float @llvm.SI.load.const(<16 x i8> %l, i32 0)
  40. %p = call i32 @llvm.SI.packf16(float %c, float 0.000000e+00)
  41. %v1 = bitcast i32 %p to float
  42. %z = call i32 @llvm.SI.packf16(float 0.000000e+00, float 0.000000e+00)
  43. %v2 = bitcast i32 %z to float
  44. call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 1, float %v1, float %v2, float %v1, float %v2)
  45. ret void
  46. }
  47.  
  48. ; Function Attrs: nounwind readnone
  49. declare float @llvm.SI.load.const(<16 x i8>, i32) #1
  50.  
  51. ; Function Attrs: nounwind readnone
  52. declare i32 @llvm.SI.packf16(float, float) #1
  53.  
  54. declare void @llvm.SI.export(i32, i32, i32, i32, i32, float, float, float, float)
  55.  
  56. attributes #0 = { "ShaderType"="0" "enable-no-nans-fp-math"="true" "unsafe-fp-math"="true" }
  57. attributes #1 = { nounwind readnone }
  58.  
  59. !0 = !{!"const", null, i32 1}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement