1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -slp-vectorizer -S -mtriple=x86_64-- -mattr=+avx | FileCheck %s --check-prefixes=CHECK,AVX1
3 ; RUN: opt < %s -slp-vectorizer -S -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s --check-prefixes=CHECK,AVX2
5 define float @matching_scalar(<4 x float>* dereferenceable(16) %p) {
6 ; CHECK-LABEL: @matching_scalar(
7 ; CHECK-NEXT: [[BC:%.*]] = bitcast <4 x float>* [[P:%.*]] to float*
8 ; CHECK-NEXT: [[R:%.*]] = load float, float* [[BC]], align 16
9 ; CHECK-NEXT: ret float [[R]]
11 %bc = bitcast <4 x float>* %p to float*
12 %r = load float, float* %bc, align 16
16 define i32 @nonmatching_scalar(<4 x float>* dereferenceable(16) %p) {
17 ; CHECK-LABEL: @nonmatching_scalar(
18 ; CHECK-NEXT: [[BC:%.*]] = bitcast <4 x float>* [[P:%.*]] to i32*
19 ; CHECK-NEXT: [[R:%.*]] = load i32, i32* [[BC]], align 16
20 ; CHECK-NEXT: ret i32 [[R]]
22 %bc = bitcast <4 x float>* %p to i32*
23 %r = load i32, i32* %bc, align 16
27 define i64 @larger_scalar(<4 x float>* dereferenceable(16) %p) {
28 ; CHECK-LABEL: @larger_scalar(
29 ; CHECK-NEXT: [[BC:%.*]] = bitcast <4 x float>* [[P:%.*]] to i64*
30 ; CHECK-NEXT: [[R:%.*]] = load i64, i64* [[BC]], align 16
31 ; CHECK-NEXT: ret i64 [[R]]
33 %bc = bitcast <4 x float>* %p to i64*
34 %r = load i64, i64* %bc, align 16
38 define i8 @smaller_scalar(<4 x float>* dereferenceable(16) %p) {
39 ; CHECK-LABEL: @smaller_scalar(
40 ; CHECK-NEXT: [[BC:%.*]] = bitcast <4 x float>* [[P:%.*]] to i8*
41 ; CHECK-NEXT: [[R:%.*]] = load i8, i8* [[BC]], align 16
42 ; CHECK-NEXT: ret i8 [[R]]
44 %bc = bitcast <4 x float>* %p to i8*
45 %r = load i8, i8* %bc, align 16
49 define i8 @smaller_scalar_256bit_vec(<8 x float>* dereferenceable(32) %p) {
50 ; CHECK-LABEL: @smaller_scalar_256bit_vec(
51 ; CHECK-NEXT: [[BC:%.*]] = bitcast <8 x float>* [[P:%.*]] to i8*
52 ; CHECK-NEXT: [[R:%.*]] = load i8, i8* [[BC]], align 32
53 ; CHECK-NEXT: ret i8 [[R]]
55 %bc = bitcast <8 x float>* %p to i8*
56 %r = load i8, i8* %bc, align 32
60 define i8 @smaller_scalar_less_aligned(<4 x float>* dereferenceable(16) %p) {
61 ; CHECK-LABEL: @smaller_scalar_less_aligned(
62 ; CHECK-NEXT: [[BC:%.*]] = bitcast <4 x float>* [[P:%.*]] to i8*
63 ; CHECK-NEXT: [[R:%.*]] = load i8, i8* [[BC]], align 4
64 ; CHECK-NEXT: ret i8 [[R]]
66 %bc = bitcast <4 x float>* %p to i8*
67 %r = load i8, i8* %bc, align 4
71 define float @matching_scalar_small_deref(<4 x float>* dereferenceable(15) %p) {
72 ; CHECK-LABEL: @matching_scalar_small_deref(
73 ; CHECK-NEXT: [[BC:%.*]] = bitcast <4 x float>* [[P:%.*]] to float*
74 ; CHECK-NEXT: [[R:%.*]] = load float, float* [[BC]], align 16
75 ; CHECK-NEXT: ret float [[R]]
77 %bc = bitcast <4 x float>* %p to float*
78 %r = load float, float* %bc, align 16
82 define float @matching_scalar_volatile(<4 x float>* dereferenceable(16) %p) {
83 ; CHECK-LABEL: @matching_scalar_volatile(
84 ; CHECK-NEXT: [[BC:%.*]] = bitcast <4 x float>* [[P:%.*]] to float*
85 ; CHECK-NEXT: [[R:%.*]] = load volatile float, float* [[BC]], align 16
86 ; CHECK-NEXT: ret float [[R]]
88 %bc = bitcast <4 x float>* %p to float*
89 %r = load volatile float, float* %bc, align 16
93 define float @nonvector(double* dereferenceable(16) %p) {
94 ; CHECK-LABEL: @nonvector(
95 ; CHECK-NEXT: [[BC:%.*]] = bitcast double* [[P:%.*]] to float*
96 ; CHECK-NEXT: [[R:%.*]] = load float, float* [[BC]], align 16
97 ; CHECK-NEXT: ret float [[R]]
99 %bc = bitcast double* %p to float*
100 %r = load float, float* %bc, align 16