tuple.carbon 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  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: %.loc8_23.1: type = tuple_type (type, type)
  13. // CHECK:STDOUT: %.loc8_23.2: type = tuple_type (i32, i32)
  14. // CHECK:STDOUT: %.loc8_23.3: type = ptr_type (i32, i32)
  15. // CHECK:STDOUT: }
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: file {
  18. // CHECK:STDOUT: %Main: <function> = fn_decl @Main
  19. // CHECK:STDOUT: }
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: fn @Main() -> %return: (i32, i32) {
  22. // CHECK:STDOUT: !entry:
  23. // CHECK:STDOUT: %.loc9_11: i32 = int_literal 15
  24. // CHECK:STDOUT: %.loc9_15: i32 = int_literal 35
  25. // CHECK:STDOUT: %.loc9_17.1: (i32, i32) = tuple_literal (%.loc9_11, %.loc9_15)
  26. // CHECK:STDOUT: %.loc9_17.2: ref i32 = tuple_access %return, element0
  27. // CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_11 to %.loc9_17.2
  28. // CHECK:STDOUT: %.loc9_17.4: ref i32 = tuple_access %return, element1
  29. // CHECK:STDOUT: %.loc9_17.5: init i32 = initialize_from %.loc9_15 to %.loc9_17.4
  30. // CHECK:STDOUT: %.loc9_17.6: init (i32, i32) = tuple_init (%.loc9_17.3, %.loc9_17.5) to %return
  31. // CHECK:STDOUT: %.loc9_17.7: init (i32, i32) = converted %.loc9_17.1, %.loc9_17.6
  32. // CHECK:STDOUT: return %.loc9_17.7
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT: