blob: 86218a67d8490ffa360fd5247ebf62a91cf78b45 [file] [log] [blame]
Simon Pilgrim804cbd62017-07-27 10:36:09 +00001; 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
7define void @test_func(%struct.SA* nocapture %ctx, i32 %n) local_unnamed_addr {
8; X64-LABEL: test_func:
9; X64: # BB#0: # %entry
10; X64-NEXT: movl (%rdi), %eax
11; X64-NEXT: movl 16(%rdi), %ecx
12; X64-NEXT: leal (%rax,%rcx), %edx
13; X64-NEXT: leal 1(%rax,%rcx), %eax
14; X64-NEXT: movl %eax, 12(%rdi)
15; X64-NEXT: leal 1(%rcx,%rdx), %eax
16; X64-NEXT: movl %eax, 16(%rdi)
17; X64-NEXT: retq
18;
19; X86-LABEL: test_func:
20; X86: # BB#0: # %entry
21; X86-NEXT: pushl %esi
22; X86-NEXT: .Lcfi0:
23; X86-NEXT: .cfi_def_cfa_offset 8
24; X86-NEXT: .Lcfi1:
25; X86-NEXT: .cfi_offset %esi, -8
26; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
27; X86-NEXT: movl (%eax), %ecx
28; X86-NEXT: movl 16(%eax), %edx
29; X86-NEXT: leal 1(%ecx,%edx), %esi
30; X86-NEXT: addl %edx, %ecx
31; X86-NEXT: movl %esi, 12(%eax)
32; X86-NEXT: leal 1(%edx,%ecx), %ecx
33; X86-NEXT: movl %ecx, 16(%eax)
34; X86-NEXT: popl %esi
35; X86-NEXT: retl
36 entry:
37 %h0 = getelementptr inbounds %struct.SA, %struct.SA* %ctx, i64 0, i32 0
38 %0 = load i32, i32* %h0, align 8
39 %h3 = getelementptr inbounds %struct.SA, %struct.SA* %ctx, i64 0, i32 3
40 %h4 = getelementptr inbounds %struct.SA, %struct.SA* %ctx, i64 0, i32 4
41 %1 = load i32, i32* %h4, align 8
42 %add = add i32 %0, 1
43 %add4 = add i32 %add, %1
44 store i32 %add4, i32* %h3, align 4
45 %add29 = add i32 %add4 , %1
46 store i32 %add29, i32* %h4, align 8
47 ret void
48}