nine_elements.carbon 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9);
  7. // CHECK:STDOUT: --- nine_elements.carbon
  8. // CHECK:STDOUT:
  9. // CHECK:STDOUT: constants {
  10. // CHECK:STDOUT: %.1: i32 = int_literal 9 [template]
  11. // CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
  12. // CHECK:STDOUT: %.3: type = ptr_type [i32; 9] [template]
  13. // CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
  14. // CHECK:STDOUT: %.5: i32 = int_literal 2 [template]
  15. // CHECK:STDOUT: %.6: i32 = int_literal 3 [template]
  16. // CHECK:STDOUT: %.7: i32 = int_literal 4 [template]
  17. // CHECK:STDOUT: %.8: i32 = int_literal 5 [template]
  18. // CHECK:STDOUT: %.9: i32 = int_literal 6 [template]
  19. // CHECK:STDOUT: %.10: i32 = int_literal 7 [template]
  20. // CHECK:STDOUT: %.11: i32 = int_literal 8 [template]
  21. // CHECK:STDOUT: %.12: type = tuple_type (i32, i32, i32, i32, i32, i32, i32, i32, i32) [template]
  22. // CHECK:STDOUT: %.13: i32 = int_literal 0 [template]
  23. // CHECK:STDOUT: %.14: i32 = int_literal 1 [template]
  24. // CHECK:STDOUT: %.15: i32 = int_literal 2 [template]
  25. // CHECK:STDOUT: %.16: i32 = int_literal 3 [template]
  26. // CHECK:STDOUT: %.17: i32 = int_literal 4 [template]
  27. // CHECK:STDOUT: %.18: i32 = int_literal 5 [template]
  28. // CHECK:STDOUT: %.19: i32 = int_literal 6 [template]
  29. // CHECK:STDOUT: %.20: i32 = int_literal 7 [template]
  30. // CHECK:STDOUT: %.21: i32 = int_literal 8 [template]
  31. // CHECK:STDOUT: %.22: [i32; 9] = tuple_value (%.4, %.5, %.6, %.7, %.8, %.9, %.10, %.11, %.1) [template]
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: file {
  35. // CHECK:STDOUT: package: <namespace> = namespace {
  36. // CHECK:STDOUT: .a = %a
  37. // CHECK:STDOUT: } [template]
  38. // CHECK:STDOUT: %.loc7_14: i32 = int_literal 9 [template = constants.%.1]
  39. // CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
  40. // CHECK:STDOUT: %a.var: ref [i32; 9] = var a
  41. // CHECK:STDOUT: %a: ref [i32; 9] = bind_name a, %a.var
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: fn @__global_init() {
  45. // CHECK:STDOUT: !entry:
  46. // CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.4]
  47. // CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.5]
  48. // CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.6]
  49. // CHECK:STDOUT: %.loc7_29: i32 = int_literal 4 [template = constants.%.7]
  50. // CHECK:STDOUT: %.loc7_32: i32 = int_literal 5 [template = constants.%.8]
  51. // CHECK:STDOUT: %.loc7_35: i32 = int_literal 6 [template = constants.%.9]
  52. // CHECK:STDOUT: %.loc7_38: i32 = int_literal 7 [template = constants.%.10]
  53. // CHECK:STDOUT: %.loc7_41: i32 = int_literal 8 [template = constants.%.11]
  54. // CHECK:STDOUT: %.loc7_44: i32 = int_literal 9 [template = constants.%.1]
  55. // CHECK:STDOUT: %.loc7_45.1: (i32, i32, i32, i32, i32, i32, i32, i32, i32) = tuple_literal (%.loc7_20, %.loc7_23, %.loc7_26, %.loc7_29, %.loc7_32, %.loc7_35, %.loc7_38, %.loc7_41, %.loc7_44)
  56. // CHECK:STDOUT: %.loc7_45.2: i32 = int_literal 0 [template = constants.%.13]
  57. // CHECK:STDOUT: %.loc7_45.3: ref i32 = array_index file.%a.var, %.loc7_45.2
  58. // CHECK:STDOUT: %.loc7_45.4: init i32 = initialize_from %.loc7_20 to %.loc7_45.3 [template = constants.%.4]
  59. // CHECK:STDOUT: %.loc7_45.5: i32 = int_literal 1 [template = constants.%.14]
  60. // CHECK:STDOUT: %.loc7_45.6: ref i32 = array_index file.%a.var, %.loc7_45.5
  61. // CHECK:STDOUT: %.loc7_45.7: init i32 = initialize_from %.loc7_23 to %.loc7_45.6 [template = constants.%.5]
  62. // CHECK:STDOUT: %.loc7_45.8: i32 = int_literal 2 [template = constants.%.15]
  63. // CHECK:STDOUT: %.loc7_45.9: ref i32 = array_index file.%a.var, %.loc7_45.8
  64. // CHECK:STDOUT: %.loc7_45.10: init i32 = initialize_from %.loc7_26 to %.loc7_45.9 [template = constants.%.6]
  65. // CHECK:STDOUT: %.loc7_45.11: i32 = int_literal 3 [template = constants.%.16]
  66. // CHECK:STDOUT: %.loc7_45.12: ref i32 = array_index file.%a.var, %.loc7_45.11
  67. // CHECK:STDOUT: %.loc7_45.13: init i32 = initialize_from %.loc7_29 to %.loc7_45.12 [template = constants.%.7]
  68. // CHECK:STDOUT: %.loc7_45.14: i32 = int_literal 4 [template = constants.%.17]
  69. // CHECK:STDOUT: %.loc7_45.15: ref i32 = array_index file.%a.var, %.loc7_45.14
  70. // CHECK:STDOUT: %.loc7_45.16: init i32 = initialize_from %.loc7_32 to %.loc7_45.15 [template = constants.%.8]
  71. // CHECK:STDOUT: %.loc7_45.17: i32 = int_literal 5 [template = constants.%.18]
  72. // CHECK:STDOUT: %.loc7_45.18: ref i32 = array_index file.%a.var, %.loc7_45.17
  73. // CHECK:STDOUT: %.loc7_45.19: init i32 = initialize_from %.loc7_35 to %.loc7_45.18 [template = constants.%.9]
  74. // CHECK:STDOUT: %.loc7_45.20: i32 = int_literal 6 [template = constants.%.19]
  75. // CHECK:STDOUT: %.loc7_45.21: ref i32 = array_index file.%a.var, %.loc7_45.20
  76. // CHECK:STDOUT: %.loc7_45.22: init i32 = initialize_from %.loc7_38 to %.loc7_45.21 [template = constants.%.10]
  77. // CHECK:STDOUT: %.loc7_45.23: i32 = int_literal 7 [template = constants.%.20]
  78. // CHECK:STDOUT: %.loc7_45.24: ref i32 = array_index file.%a.var, %.loc7_45.23
  79. // CHECK:STDOUT: %.loc7_45.25: init i32 = initialize_from %.loc7_41 to %.loc7_45.24 [template = constants.%.11]
  80. // CHECK:STDOUT: %.loc7_45.26: i32 = int_literal 8 [template = constants.%.21]
  81. // CHECK:STDOUT: %.loc7_45.27: ref i32 = array_index file.%a.var, %.loc7_45.26
  82. // CHECK:STDOUT: %.loc7_45.28: init i32 = initialize_from %.loc7_44 to %.loc7_45.27 [template = constants.%.1]
  83. // CHECK:STDOUT: %.loc7_45.29: init [i32; 9] = array_init (%.loc7_45.4, %.loc7_45.7, %.loc7_45.10, %.loc7_45.13, %.loc7_45.16, %.loc7_45.19, %.loc7_45.22, %.loc7_45.25, %.loc7_45.28) to file.%a.var [template = constants.%.22]
  84. // CHECK:STDOUT: %.loc7_45.30: init [i32; 9] = converted %.loc7_45.1, %.loc7_45.29 [template = constants.%.22]
  85. // CHECK:STDOUT: assign file.%a.var, %.loc7_45.30
  86. // CHECK:STDOUT: return
  87. // CHECK:STDOUT: }
  88. // CHECK:STDOUT: