Simon Pilgrim | 804cbd6 | 2017-07-27 10:36:09 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| 2 | ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s -check-prefix=X64 |
| 3 | ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s -check-prefix=X86 |
| 4 | |
| 5 | %struct.SA = type { i32 , i32 , i32 , i32 ,i32 } |
| 6 | |
| 7 | define void @test_func(%struct.SA* nocapture %ctx, i32 %n) local_unnamed_addr { |
| 8 | ; X64-LABEL: test_func: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 9 | ; X64: # %bb.0: # %entry |
Simon Pilgrim | 804cbd6 | 2017-07-27 10:36:09 +0000 | [diff] [blame] | 10 | ; X64-NEXT: movl (%rdi), %eax |
| 11 | ; X64-NEXT: movl 16(%rdi), %ecx |
Matt Morehouse | 9e658c9 | 2017-12-01 22:20:26 +0000 | [diff] [blame] | 12 | ; X64-NEXT: leal (%rax,%rcx), %edx |
Simon Pilgrim | 804cbd6 | 2017-07-27 10:36:09 +0000 | [diff] [blame] | 13 | ; X64-NEXT: leal 1(%rax,%rcx), %eax |
| 14 | ; X64-NEXT: movl %eax, 12(%rdi) |
Matt Morehouse | 9e658c9 | 2017-12-01 22:20:26 +0000 | [diff] [blame] | 15 | ; X64-NEXT: leal 1(%rcx,%rdx), %eax |
Simon Pilgrim | 804cbd6 | 2017-07-27 10:36:09 +0000 | [diff] [blame] | 16 | ; X64-NEXT: movl %eax, 16(%rdi) |
| 17 | ; X64-NEXT: retq |
| 18 | ; |
| 19 | ; X86-LABEL: test_func: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 20 | ; X86: # %bb.0: # %entry |
Matt Morehouse | 9e658c9 | 2017-12-01 22:20:26 +0000 | [diff] [blame] | 21 | ; X86-NEXT: pushl %esi |
| 22 | ; X86-NEXT: .cfi_def_cfa_offset 8 |
| 23 | ; X86-NEXT: .cfi_offset %esi, -8 |
Simon Pilgrim | 804cbd6 | 2017-07-27 10:36:09 +0000 | [diff] [blame] | 24 | ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax |
| 25 | ; X86-NEXT: movl (%eax), %ecx |
| 26 | ; X86-NEXT: movl 16(%eax), %edx |
Matt Morehouse | 9e658c9 | 2017-12-01 22:20:26 +0000 | [diff] [blame] | 27 | ; X86-NEXT: leal 1(%ecx,%edx), %esi |
Simon Pilgrim | 804cbd6 | 2017-07-27 10:36:09 +0000 | [diff] [blame] | 28 | ; X86-NEXT: addl %edx, %ecx |
Matt Morehouse | 9e658c9 | 2017-12-01 22:20:26 +0000 | [diff] [blame] | 29 | ; X86-NEXT: movl %esi, 12(%eax) |
| 30 | ; X86-NEXT: leal 1(%edx,%ecx), %ecx |
Simon Pilgrim | 804cbd6 | 2017-07-27 10:36:09 +0000 | [diff] [blame] | 31 | ; X86-NEXT: movl %ecx, 16(%eax) |
Matt Morehouse | 9e658c9 | 2017-12-01 22:20:26 +0000 | [diff] [blame] | 32 | ; X86-NEXT: popl %esi |
Petar Jovanovic | e2bfcd6 | 2018-04-24 10:32:08 +0000 | [diff] [blame] | 33 | ; X86-NEXT: .cfi_def_cfa_offset 4 |
Simon Pilgrim | 804cbd6 | 2017-07-27 10:36:09 +0000 | [diff] [blame] | 34 | ; X86-NEXT: retl |
| 35 | entry: |
| 36 | %h0 = getelementptr inbounds %struct.SA, %struct.SA* %ctx, i64 0, i32 0 |
| 37 | %0 = load i32, i32* %h0, align 8 |
| 38 | %h3 = getelementptr inbounds %struct.SA, %struct.SA* %ctx, i64 0, i32 3 |
| 39 | %h4 = getelementptr inbounds %struct.SA, %struct.SA* %ctx, i64 0, i32 4 |
| 40 | %1 = load i32, i32* %h4, align 8 |
| 41 | %add = add i32 %0, 1 |
| 42 | %add4 = add i32 %add, %1 |
| 43 | store i32 %add4, i32* %h3, align 4 |
| 44 | %add29 = add i32 %add4 , %1 |
| 45 | store i32 %add29, i32* %h4, align 8 |
| 46 | ret void |
| 47 | } |