make current codegen visible in the checks, so we can decide if it's right
[oota-llvm.git] / test / CodeGen / X86 / pr11985.ll
1 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=prescott | FileCheck %s --check-prefix=PRESCOTT
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=nehalem | FileCheck %s --check-prefix=NEHALEM
3
4 ;;; TODO: The last run line chooses cpu=nehalem to reveal possible bugs in the "foo" test case.
5 ;;;
6 ;;; Nehalem has a 'fast unaligned memory' attribute, so (1) some of the loads and stores
7 ;;; are certainly unaligned and (2) the first load and first store overlap with the second
8 ;;; load and second store respectively.
9 ;;;
10 ;;; Is either of these sequences ideal? 
11 ;;; Is the ideal code being generated for all CPU models?
12
13 define float @foo(i8* nocapture %buf, float %a, float %b) nounwind uwtable {
14 ; PRESCOTT-LABEL: foo:
15 ; PRESCOTT:       # BB#0: # %entry
16 ; PRESCOTT-NEXT:    movw .Ltmp0+20(%rip), %ax
17 ; PRESCOTT-NEXT:    movw %ax, 20(%rdi)
18 ; PRESCOTT-NEXT:    movl .Ltmp0+16(%rip), %eax
19 ; PRESCOTT-NEXT:    movl %eax, 16(%rdi)
20 ; PRESCOTT-NEXT:    movq .Ltmp0+8(%rip), %rax
21 ; PRESCOTT-NEXT:    movq %rax, 8(%rdi)
22 ; PRESCOTT-NEXT:    movq .Ltmp0(%rip), %rax
23 ; PRESCOTT-NEXT:    movq %rax, (%rdi)
24 ;
25 ; NEHALEM-LABEL: foo:
26 ; NEHALEM:       # BB#0: # %entry
27 ; NEHALEM-NEXT:    movq .Ltmp0+14(%rip), %rax
28 ; NEHALEM-NEXT:    movq %rax, 14(%rdi)
29 ; NEHALEM-NEXT:    movups .Ltmp0(%rip), %xmm2
30 ; NEHALEM-NEXT:    movups %xmm2, (%rdi)
31
32 entry:
33   tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %buf, i8* blockaddress(@foo, %out), i64 22, i32 1, i1 false)
34   br label %out
35
36 out:                                              ; preds = %entry
37   %add = fadd float %a, %b
38   ret float %add
39 }
40
41 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind