blob: 8fb000bae827dd58e01ae94ff53214aa88b56e4d [file] [log] [blame]
Andrew Zhoginaf3d5fe2017-07-13 18:57:40 +00001; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=bdver4 | FileCheck %s
3
4define <4 x i32> @rot_v4i32_splat(<4 x i32> %x) {
5; CHECK-LABEL: rot_v4i32_splat:
6; CHECK: # BB#0:
7; CHECK-NEXT: vprotd $31, %xmm0, %xmm0
8; CHECK-NEXT: retq
9 %1 = lshr <4 x i32> %x, <i32 1, i32 1, i32 1, i32 1>
10 %2 = shl <4 x i32> %x, <i32 31, i32 31, i32 31, i32 31>
11 %3 = or <4 x i32> %1, %2
12 ret <4 x i32> %3
13}
14
15define <4 x i32> @rot_v4i32_non_splat(<4 x i32> %x) {
16; CHECK-LABEL: rot_v4i32_non_splat:
17; CHECK: # BB#0:
Andrew Zhogin67a64042017-07-16 23:11:45 +000018; CHECK-NEXT: vprotd {{.*}}(%rip), %xmm0, %xmm0
Andrew Zhoginaf3d5fe2017-07-13 18:57:40 +000019; CHECK-NEXT: retq
20 %1 = lshr <4 x i32> %x, <i32 1, i32 2, i32 3, i32 4>
21 %2 = shl <4 x i32> %x, <i32 31, i32 30, i32 29, i32 28>
22 %3 = or <4 x i32> %1, %2
23 ret <4 x i32> %3
24}
25
26define <4 x i32> @rot_v4i32_splat_2masks(<4 x i32> %x) {
27; CHECK-LABEL: rot_v4i32_splat_2masks:
28; CHECK: # BB#0:
29; CHECK-NEXT: vprotd $31, %xmm0, %xmm0
30; CHECK-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
31; CHECK-NEXT: retq
32 %1 = lshr <4 x i32> %x, <i32 1, i32 1, i32 1, i32 1>
33 %2 = and <4 x i32> %1, <i32 4294901760, i32 4294901760, i32 4294901760, i32 4294901760>
34
35 %3 = shl <4 x i32> %x, <i32 31, i32 31, i32 31, i32 31>
36 %4 = and <4 x i32> %3, <i32 0, i32 4294901760, i32 0, i32 4294901760>
37 %5 = or <4 x i32> %2, %4
38 ret <4 x i32> %5
39}
40
41define <4 x i32> @rot_v4i32_non_splat_2masks(<4 x i32> %x) {
42; CHECK-LABEL: rot_v4i32_non_splat_2masks:
43; CHECK: # BB#0:
Andrew Zhogin67a64042017-07-16 23:11:45 +000044; CHECK-NEXT: vprotd {{.*}}(%rip), %xmm0, %xmm0
45; CHECK-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
Andrew Zhoginaf3d5fe2017-07-13 18:57:40 +000046; CHECK-NEXT: retq
47 %1 = lshr <4 x i32> %x, <i32 1, i32 2, i32 3, i32 4>
48 %2 = and <4 x i32> %1, <i32 4294901760, i32 4294901760, i32 4294901760, i32 4294901760>
49
50 %3 = shl <4 x i32> %x, <i32 31, i32 30, i32 29, i32 28>
51 %4 = and <4 x i32> %3, <i32 0, i32 4294901760, i32 0, i32 4294901760>
52 %5 = or <4 x i32> %2, %4
53 ret <4 x i32> %5
54}