tuple.carbon 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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: %.3: type = ptr_type (i32, i32) [template]
  15. // CHECK:STDOUT: %.4: i32 = int_literal 15 [template]
  16. // CHECK:STDOUT: %.5: i32 = int_literal 35 [template]
  17. // CHECK:STDOUT: %.6: (i32, i32) = tuple_value (%.4, %.5) [template]
  18. // CHECK:STDOUT: }
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: file {
  21. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  22. // CHECK:STDOUT: .Main = %Main
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT: %Main: <function> = fn_decl @Main [template] {
  25. // CHECK:STDOUT: %.loc8_23.1: (type, type) = tuple_literal (i32, i32)
  26. // CHECK:STDOUT: %.loc8_23.2: type = converted %.loc8_23.1, constants.%.2 [template = constants.%.2]
  27. // CHECK:STDOUT: @Main.%return: ref (i32, i32) = var <return slot>
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT:
  31. // CHECK:STDOUT: fn @Main() -> %return: (i32, i32) {
  32. // CHECK:STDOUT: !entry:
  33. // CHECK:STDOUT: %.loc9_11: i32 = int_literal 15 [template = constants.%.4]
  34. // CHECK:STDOUT: %.loc9_15: i32 = int_literal 35 [template = constants.%.5]
  35. // CHECK:STDOUT: %.loc9_17.1: (i32, i32) = tuple_literal (%.loc9_11, %.loc9_15)
  36. // CHECK:STDOUT: %.loc9_17.2: ref i32 = tuple_access %return, element0
  37. // CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_11 to %.loc9_17.2 [template = constants.%.4]
  38. // CHECK:STDOUT: %.loc9_17.4: ref i32 = tuple_access %return, element1
  39. // CHECK:STDOUT: %.loc9_17.5: init i32 = initialize_from %.loc9_15 to %.loc9_17.4 [template = constants.%.5]
  40. // CHECK:STDOUT: %.loc9_17.6: init (i32, i32) = tuple_init (%.loc9_17.3, %.loc9_17.5) to %return [template = constants.%.6]
  41. // CHECK:STDOUT: %.loc9_17.7: init (i32, i32) = converted %.loc9_17.1, %.loc9_17.6 [template = constants.%.6]
  42. // CHECK:STDOUT: return %.loc9_17.7
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT: