two_entries.carbon 1.4 KB

1234567891011121314151617181920212223242526272829303132
  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 Run() -> i32 {
  7. var x: {.a: i32, .b: i32} = {.a = 1, .b = 2};
  8. var y: {.a: i32, .b: i32} = x;
  9. return 0;
  10. }
  11. // CHECK:STDOUT: ; ModuleID = 'two_entries.carbon'
  12. // CHECK:STDOUT: source_filename = "two_entries.carbon"
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: define i32 @main() {
  15. // CHECK:STDOUT: %x = alloca { i32, i32 }, align 8
  16. // CHECK:STDOUT: %a = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 0
  17. // CHECK:STDOUT: store i32 1, ptr %a, align 4
  18. // CHECK:STDOUT: %b = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 1
  19. // CHECK:STDOUT: store i32 2, ptr %b, align 4
  20. // CHECK:STDOUT: %y = alloca { i32, i32 }, align 8
  21. // CHECK:STDOUT: %a1 = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 0
  22. // CHECK:STDOUT: %1 = load i32, ptr %a1, align 4
  23. // CHECK:STDOUT: %a2 = getelementptr inbounds { i32, i32 }, ptr %y, i32 0, i32 0
  24. // CHECK:STDOUT: store i32 %1, ptr %a2, align 4
  25. // CHECK:STDOUT: %b3 = getelementptr inbounds { i32, i32 }, ptr %x, i32 0, i32 1
  26. // CHECK:STDOUT: %2 = load i32, ptr %b3, align 4
  27. // CHECK:STDOUT: %b4 = getelementptr inbounds { i32, i32 }, ptr %y, i32 0, i32 1
  28. // CHECK:STDOUT: store i32 %2, ptr %b4, align 4
  29. // CHECK:STDOUT: ret i32 0
  30. // CHECK:STDOUT: }