| Simon Pilgrim | d128222 | 2017-07-04 12:33:53 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| 2 | ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+xop | FileCheck %s --check-prefix=XOP |
| 3 | ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl | FileCheck %s --check-prefix=AVX512 |
| 4 | |
| 5 | ; fold (rot (rot x, c1), c2) -> rot x, c1+c2 |
| 6 | define <4 x i32> @combine_vec_rot_rot(<4 x i32> %x) { |
| 7 | ; XOP-LABEL: combine_vec_rot_rot: |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 8 | ; XOP: # %bb.0: |
| Andrew Zhogin | 67a6404 | 2017-07-16 23:11:45 +0000 | [diff] [blame] | 9 | ; XOP-NEXT: vprotd {{.*}}(%rip), %xmm0, %xmm0 |
| Simon Pilgrim | d128222 | 2017-07-04 12:33:53 +0000 | [diff] [blame] | 10 | ; XOP-NEXT: retq |
| 11 | ; |
| 12 | ; AVX512-LABEL: combine_vec_rot_rot: |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 13 | ; AVX512: # %bb.0: |
| Simon Pilgrim | 1cbe8c2 | 2017-07-17 14:11:30 +0000 | [diff] [blame] | 14 | ; AVX512-NEXT: vprolvd {{.*}}(%rip), %xmm0, %xmm0 |
| Simon Pilgrim | d128222 | 2017-07-04 12:33:53 +0000 | [diff] [blame] | 15 | ; AVX512-NEXT: retq |
| 16 | %1 = lshr <4 x i32> %x, <i32 1, i32 2, i32 3, i32 4> |
| 17 | %2 = shl <4 x i32> %x, <i32 31, i32 30, i32 29, i32 28> |
| 18 | %3 = or <4 x i32> %1, %2 |
| 19 | %4 = lshr <4 x i32> %3, <i32 12, i32 13, i32 14, i32 15> |
| 20 | %5 = shl <4 x i32> %3, <i32 20, i32 19, i32 18, i32 17> |
| 21 | %6 = or <4 x i32> %4, %5 |
| 22 | ret <4 x i32> %6 |
| 23 | } |
| 24 | |
| 25 | define <4 x i32> @combine_vec_rot_rot_splat(<4 x i32> %x) { |
| 26 | ; XOP-LABEL: combine_vec_rot_rot_splat: |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 27 | ; XOP: # %bb.0: |
| Andrew Zhogin | 45d1928 | 2017-07-05 17:55:42 +0000 | [diff] [blame] | 28 | ; XOP-NEXT: vprotd $7, %xmm0, %xmm0 |
| Simon Pilgrim | d128222 | 2017-07-04 12:33:53 +0000 | [diff] [blame] | 29 | ; XOP-NEXT: retq |
| 30 | ; |
| 31 | ; AVX512-LABEL: combine_vec_rot_rot_splat: |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 32 | ; AVX512: # %bb.0: |
| Simon Pilgrim | 1cbe8c2 | 2017-07-17 14:11:30 +0000 | [diff] [blame] | 33 | ; AVX512-NEXT: vprold $7, %xmm0, %xmm0 |
| Simon Pilgrim | d128222 | 2017-07-04 12:33:53 +0000 | [diff] [blame] | 34 | ; AVX512-NEXT: retq |
| 35 | %1 = lshr <4 x i32> %x, <i32 3, i32 3, i32 3, i32 3> |
| 36 | %2 = shl <4 x i32> %x, <i32 29, i32 29, i32 29, i32 29> |
| 37 | %3 = or <4 x i32> %1, %2 |
| 38 | %4 = lshr <4 x i32> %3, <i32 22, i32 22, i32 22, i32 22> |
| 39 | %5 = shl <4 x i32> %3, <i32 10, i32 10, i32 10, i32 10> |
| 40 | %6 = or <4 x i32> %4, %5 |
| 41 | ret <4 x i32> %6 |
| 42 | } |
| 43 | |
| 44 | define <4 x i32> @combine_vec_rot_rot_splat_zero(<4 x i32> %x) { |
| 45 | ; XOP-LABEL: combine_vec_rot_rot_splat_zero: |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 46 | ; XOP: # %bb.0: |
| Simon Pilgrim | d128222 | 2017-07-04 12:33:53 +0000 | [diff] [blame] | 47 | ; XOP-NEXT: retq |
| 48 | ; |
| 49 | ; AVX512-LABEL: combine_vec_rot_rot_splat_zero: |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 50 | ; AVX512: # %bb.0: |
| Simon Pilgrim | d128222 | 2017-07-04 12:33:53 +0000 | [diff] [blame] | 51 | ; AVX512-NEXT: retq |
| 52 | %1 = lshr <4 x i32> %x, <i32 1, i32 1, i32 1, i32 1> |
| 53 | %2 = shl <4 x i32> %x, <i32 31, i32 31, i32 31, i32 31> |
| 54 | %3 = or <4 x i32> %1, %2 |
| 55 | %4 = lshr <4 x i32> %3, <i32 31, i32 31, i32 31, i32 31> |
| 56 | %5 = shl <4 x i32> %3, <i32 1, i32 1, i32 1, i32 1> |
| 57 | %6 = or <4 x i32> %4, %5 |
| 58 | ret <4 x i32> %6 |
| 59 | } |