1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -interleaved-access -S %s | FileCheck %s
4 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-apple-macosx10.15.0"
7 ; No interleaved load instruction is generated, but the shuffle is moved just
9 define <2 x double> @shuffle_binop_fol(<4 x double>* %ptr) {
10 ; CHECK-LABEL: @shuffle_binop_fol(
11 ; CHECK-NEXT: vector.body.preheader:
12 ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x double>, <4 x double>* [[PTR:%.*]], align 8
13 ; CHECK-NEXT: [[EXTRACTED1:%.*]] = shufflevector <4 x double> [[WIDE_LOAD]], <4 x double> poison, <2 x i32> <i32 0, i32 2>
14 ; CHECK-NEXT: [[EXTRACTED2:%.*]] = shufflevector <4 x double> <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>, <4 x double> poison, <2 x i32> <i32 0, i32 2>
15 ; CHECK-NEXT: [[FADD3:%.*]] = fadd <2 x double> [[EXTRACTED1]], [[EXTRACTED2]]
16 ; CHECK-NEXT: ret <2 x double> [[FADD3]]
18 vector.body.preheader:
19 %wide.load = load <4 x double>, <4 x double>* %ptr, align 8
20 %fadd = fadd <4 x double> %wide.load, <double 1.0, double 1.0, double 1.0, double 1.0>
21 %extracted = shufflevector <4 x double> %fadd, <4 x double> undef, <2 x i32> <i32 0, i32 2>
22 ret <2 x double> %extracted
25 define <2 x double> @shuffle_binop_fol_oob(<4 x double>* %ptr) {
26 ; CHECK-LABEL: @shuffle_binop_fol_oob(
27 ; CHECK-NEXT: vector.body.preheader:
28 ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x double>, <4 x double>* [[PTR:%.*]], align 8
29 ; CHECK-NEXT: [[FADD:%.*]] = fadd <4 x double> [[WIDE_LOAD]], <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
30 ; CHECK-NEXT: [[EXTRACTED:%.*]] = shufflevector <4 x double> [[FADD]], <4 x double> undef, <2 x i32> <i32 0, i32 4>
31 ; CHECK-NEXT: ret <2 x double> [[EXTRACTED]]
33 vector.body.preheader:
34 %wide.load = load <4 x double>, <4 x double>* %ptr, align 8
35 %fadd = fadd <4 x double> %wide.load, <double 1.0, double 1.0, double 1.0, double 1.0>
36 %extracted = shufflevector <4 x double> %fadd, <4 x double> undef, <2 x i32> <i32 0, i32 4>
37 ret <2 x double> %extracted
40 ; No interleaved load instruction is generated, but the extractelement
41 ; instructions are updated to use the shuffle instead of the load.
42 define void @shuffle_extract(<4 x double>* %ptr, i1 %c) {
43 ; CHECK-LABEL: @shuffle_extract(
44 ; CHECK-NEXT: vector.body.preheader:
45 ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x double>, <4 x double>* [[PTR:%.*]], align 8
46 ; CHECK-NEXT: [[EXTRACTED:%.*]] = shufflevector <4 x double> [[WIDE_LOAD]], <4 x double> undef, <2 x i32> <i32 0, i32 2>
47 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_THEN:%.*]], label [[IF_MERGE:%.*]]
49 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x double> [[EXTRACTED]], i64 0
50 ; CHECK-NEXT: call void @use(double [[TMP0]])
51 ; CHECK-NEXT: br label [[IF_MERGE]]
53 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <2 x double> [[EXTRACTED]], i64 1
54 ; CHECK-NEXT: call void @use(double [[TMP1]])
55 ; CHECK-NEXT: ret void
57 vector.body.preheader:
58 %wide.load = load <4 x double>, <4 x double>* %ptr, align 8
59 %extracted = shufflevector <4 x double> %wide.load, <4 x double> undef, <2 x i32> <i32 0, i32 2>
60 br i1 %c, label %if.then, label %if.merge
63 %e0 = extractelement <4 x double> %wide.load, i32 0
64 call void @use(double %e0)
68 %e1 = extractelement <4 x double> %wide.load, i32 2
69 call void @use(double %e1)
73 declare void @use(double)