aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/SLPVectorizer/X86/extract.ll
blob: 9a6ee2afc8ebb90dde5b195a21e7e68420e7b94c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
;CHECK: fextr
;CHECK-NOT: insertelement
;CHECK-NOT: extractelement
;CHECK: fadd <2 x double>
;CHECK: ret void
define void @fextr(double* %ptr) {
entry:
  %LD = load <2 x double>, <2 x double>* undef
  %V0 = extractelement <2 x double> %LD, i32 0
  %V1 = extractelement <2 x double> %LD, i32 1
  %P0 = getelementptr inbounds double, double* %ptr, i64 0
  %P1 = getelementptr inbounds double, double* %ptr, i64 1
  %A0 = fadd double %V0, 0.0
  %A1 = fadd double %V1, 1.1
  store double %A0, double* %P0, align 4
  store double %A1, double* %P1, align 4
  ret void
}

;CHECK: fextr1
;CHECK: insertelement
;CHECK: insertelement
;CHECK: ret void
define void @fextr1(double* %ptr) {
entry:
  %LD = load <2 x double>, <2 x double>* undef
  %V0 = extractelement <2 x double> %LD, i32 0
  %V1 = extractelement <2 x double> %LD, i32 1
  %P0 = getelementptr inbounds double, double* %ptr, i64 1  ; <--- incorrect order
  %P1 = getelementptr inbounds double, double* %ptr, i64 0
  %A0 = fadd double %V0, 1.2
  %A1 = fadd double %V1, 3.4
  store double %A0, double* %P0, align 4
  store double %A1, double* %P1, align 4
  ret void
}

;CHECK: fextr2
;CHECK: insertelement
;CHECK: insertelement
;CHECK: ret void
define void @fextr2(double* %ptr) {
entry:
  %LD = load <4 x double>, <4 x double>* undef
  %V0 = extractelement <4 x double> %LD, i32 0  ; <--- invalid size.
  %V1 = extractelement <4 x double> %LD, i32 1
  %P0 = getelementptr inbounds double, double* %ptr, i64 0
  %P1 = getelementptr inbounds double, double* %ptr, i64 1
  %A0 = fadd double %V0, 5.5
  %A1 = fadd double %V1, 6.6
  store double %A0, double* %P0, align 4
  store double %A1, double* %P1, align 4
  ret void
}