1; RUN: opt < %s -basicaa -slp-vectorizer -S -mcpu=corei7-avx | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6define void @test1(x86_mmx %a, x86_mmx %b, i64* %ptr) {
7; Ensure we can handle x86_mmx values which are primitive and can be bitcast
8; with integer types but can't be put into a vector.
9;
10; CHECK-LABEL: @test1
11; CHECK:         store i64
12; CHECK:         store i64
13; CHECK:         ret void
14entry:
15  %a.cast = bitcast x86_mmx %a to i64
16  %b.cast = bitcast x86_mmx %b to i64
17  %a.and = and i64 %a.cast, 42
18  %b.and = and i64 %b.cast, 42
19  %gep = getelementptr i64* %ptr, i32 1
20  store i64 %a.and, i64* %ptr
21  store i64 %b.and, i64* %gep
22  ret void
23}
24
25define void @test2(x86_mmx %a, x86_mmx %b) {
26; Same as @test1 but using phi-input vectorization instead of store
27; vectorization.
28;
29; CHECK-LABEL: @test2
30; CHECK:         and i64
31; CHECK:         and i64
32; CHECK:         ret void
33entry:
34  br i1 undef, label %if.then, label %exit
35
36if.then:
37  %a.cast = bitcast x86_mmx %a to i64
38  %b.cast = bitcast x86_mmx %b to i64
39  %a.and = and i64 %a.cast, 42
40  %b.and = and i64 %b.cast, 42
41  br label %exit
42
43exit:
44  %a.phi = phi i64 [ 0, %entry ], [ %a.and, %if.then ]
45  %b.phi = phi i64 [ 0, %entry ], [ %b.and, %if.then ]
46  tail call void @f(i64 %a.phi, i64 %b.phi)
47  ret void
48}
49
50declare void @f(i64, i64)
51