Andrew Zhogin | af3d5fe | 2017-07-13 18:57:40 +0000 | [diff] [blame] | 1 | ; 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 | |
| 4 | define <4 x i32> @rot_v4i32_splat(<4 x i32> %x) { |
| 5 | ; CHECK-LABEL: rot_v4i32_splat: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 6 | ; CHECK: # %bb.0: |
Andrew Zhogin | af3d5fe | 2017-07-13 18:57:40 +0000 | [diff] [blame] | 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 | |
| 15 | define <4 x i32> @rot_v4i32_non_splat(<4 x i32> %x) { |
| 16 | ; CHECK-LABEL: rot_v4i32_non_splat: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 17 | ; CHECK: # %bb.0: |
Andrew Zhogin | 67a6404 | 2017-07-16 23:11:45 +0000 | [diff] [blame] | 18 | ; CHECK-NEXT: vprotd {{.*}}(%rip), %xmm0, %xmm0 |
Andrew Zhogin | af3d5fe | 2017-07-13 18:57:40 +0000 | [diff] [blame] | 19 | ; 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 | |
| 26 | define <4 x i32> @rot_v4i32_splat_2masks(<4 x i32> %x) { |
| 27 | ; CHECK-LABEL: rot_v4i32_splat_2masks: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 28 | ; CHECK: # %bb.0: |
Andrew Zhogin | af3d5fe | 2017-07-13 18:57:40 +0000 | [diff] [blame] | 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 | |
| 41 | define <4 x i32> @rot_v4i32_non_splat_2masks(<4 x i32> %x) { |
| 42 | ; CHECK-LABEL: rot_v4i32_non_splat_2masks: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 43 | ; CHECK: # %bb.0: |
Andrew Zhogin | 67a6404 | 2017-07-16 23:11:45 +0000 | [diff] [blame] | 44 | ; CHECK-NEXT: vprotd {{.*}}(%rip), %xmm0, %xmm0 |
| 45 | ; CHECK-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0 |
Andrew Zhogin | af3d5fe | 2017-07-13 18:57:40 +0000 | [diff] [blame] | 46 | ; 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 | } |