1; RUN: llc < %s -march=x86-64 -mattr=+sse4.1 | FileCheck %s
2
3;CHECK-LABEL: load_2_i8:
4; A single 16-bit load
5;CHECK: pmovzxbq
6;CHECK: paddq
7;CHECK: pshufb
8; A single 16-bit store
9;CHECK: movw
10;CHECK: ret
11
12define void @load_2_i8(<2 x i8>* %A)  {
13   %T = load <2 x i8>, <2 x i8>* %A
14   %G = add <2 x i8> %T, <i8 9, i8 7>
15   store <2 x i8> %G, <2 x i8>* %A
16   ret void
17}
18
19;CHECK-LABEL: load_2_i16:
20; Read 32-bits
21;CHECK: pmovzxwq
22;CHECK: paddq
23;CHECK: pshufd
24;CHECK: movd
25;CHECK: ret
26define void @load_2_i16(<2 x i16>* %A)  {
27   %T = load <2 x i16>, <2 x i16>* %A
28   %G = add <2 x i16> %T, <i16 9, i16 7>
29   store <2 x i16> %G, <2 x i16>* %A
30   ret void
31}
32
33;CHECK-LABEL: load_2_i32:
34;CHECK: pmovzxdq
35;CHECK: paddd
36;CHECK: pshufd
37;CHECK: ret
38define void @load_2_i32(<2 x i32>* %A)  {
39   %T = load <2 x i32>, <2 x i32>* %A
40   %G = add <2 x i32> %T, <i32 9, i32 7>
41   store <2 x i32> %G, <2 x i32>* %A
42   ret void
43}
44
45;CHECK-LABEL: load_4_i8:
46;CHECK: pmovzxbd
47;CHECK: paddd
48;CHECK: pshufb
49;CHECK: ret
50define void @load_4_i8(<4 x i8>* %A)  {
51   %T = load <4 x i8>, <4 x i8>* %A
52   %G = add <4 x i8> %T, <i8 1, i8 4, i8 9, i8 7>
53   store <4 x i8> %G, <4 x i8>* %A
54   ret void
55}
56
57;CHECK-LABEL: load_4_i16:
58;CHECK: pmovzxwd
59;CHECK: paddw
60;CHECK: pshufb
61;CHECK: ret
62define void @load_4_i16(<4 x i16>* %A)  {
63   %T = load <4 x i16>, <4 x i16>* %A
64   %G = add <4 x i16> %T, <i16 1, i16 4, i16 9, i16 7>
65   store <4 x i16> %G, <4 x i16>* %A
66   ret void
67}
68
69;CHECK-LABEL: load_8_i8:
70;CHECK: pmovzxbw
71;CHECK: paddb
72;CHECK: pshufb
73;CHECK: ret
74define void @load_8_i8(<8 x i8>* %A)  {
75   %T = load <8 x i8>, <8 x i8>* %A
76   %G = add <8 x i8> %T, %T
77   store <8 x i8> %G, <8 x i8>* %A
78   ret void
79}
80