tuple.carbon 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. fn Main() -> (i32, i32) {
  7. return (15, 35);
  8. }
  9. // CHECK:STDOUT: --- tuple.carbon
  10. // CHECK:STDOUT:
  11. // CHECK:STDOUT: constants {
  12. // CHECK:STDOUT: %.1: type = tuple_type (type, type) [template]
  13. // CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template]
  14. // CHECK:STDOUT: %Main: type = fn_type @Main [template]
  15. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  16. // CHECK:STDOUT: %struct: Main = struct_value () [template]
  17. // CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template]
  18. // CHECK:STDOUT: %.5: i32 = int_literal 15 [template]
  19. // CHECK:STDOUT: %.6: i32 = int_literal 35 [template]
  20. // CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  25. // CHECK:STDOUT: .Core = %Core
  26. // CHECK:STDOUT: .Main = %Main.decl
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  29. // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {
  30. // CHECK:STDOUT: %.loc8_23.1: (type, type) = tuple_literal (i32, i32)
  31. // CHECK:STDOUT: %.loc8_23.2: type = converted %.loc8_23.1, constants.%.2 [template = constants.%.2]
  32. // CHECK:STDOUT: @Main.%return: ref (i32, i32) = var <return slot>
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: fn @Main() -> %return: (i32, i32) {
  37. // CHECK:STDOUT: !entry:
  38. // CHECK:STDOUT: %.loc9_11: i32 = int_literal 15 [template = constants.%.5]
  39. // CHECK:STDOUT: %.loc9_15: i32 = int_literal 35 [template = constants.%.6]
  40. // CHECK:STDOUT: %.loc9_17.1: (i32, i32) = tuple_literal (%.loc9_11, %.loc9_15)
  41. // CHECK:STDOUT: %.loc9_17.2: ref i32 = tuple_access %return, element0
  42. // CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_11 to %.loc9_17.2 [template = constants.%.5]
  43. // CHECK:STDOUT: %.loc9_17.4: ref i32 = tuple_access %return, element1
  44. // CHECK:STDOUT: %.loc9_17.5: init i32 = initialize_from %.loc9_15 to %.loc9_17.4 [template = constants.%.6]
  45. // CHECK:STDOUT: %.loc9_17.6: init (i32, i32) = tuple_init (%.loc9_17.3, %.loc9_17.5) to %return [template = constants.%tuple]
  46. // CHECK:STDOUT: %.loc9_18: init (i32, i32) = converted %.loc9_17.1, %.loc9_17.6 [template = constants.%tuple]
  47. // CHECK:STDOUT: return %.loc9_18 to %return
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT: