|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 |
| 2 | +; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=sse2 | FileCheck %s |
| 3 | +; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=avx2 | FileCheck %s |
| 4 | + |
| 5 | +; TODO: fold to identity |
| 6 | + |
| 7 | +define <8 x i32> @concat_extract_subvectors(<8 x i32> %x) { |
| 8 | +; CHECK-LABEL: define <8 x i32> @concat_extract_subvectors( |
| 9 | +; CHECK-SAME: <8 x i32> [[X:%.*]]) #[[ATTR0:[0-9]+]] { |
| 10 | +; CHECK-NEXT: [[LO:%.*]] = shufflevector <8 x i32> [[X]], <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 11 | +; CHECK-NEXT: [[HI:%.*]] = shufflevector <8 x i32> [[X]], <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7> |
| 12 | +; CHECK-NEXT: [[CONCAT:%.*]] = shufflevector <4 x i32> [[LO]], <4 x i32> [[HI]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 13 | +; CHECK-NEXT: ret <8 x i32> [[CONCAT]] |
| 14 | +; |
| 15 | + %lo = shufflevector <8 x i32> %x, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 16 | + %hi = shufflevector <8 x i32> %x, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7> |
| 17 | + %concat = shufflevector <4 x i32> %lo, <4 x i32> %hi, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 18 | + ret <8 x i32> %concat |
| 19 | +} |
| 20 | + |
| 21 | +; negative test - shuffle contains undef |
| 22 | + |
| 23 | +define <8 x i32> @concat_extract_subvectors_undef(<8 x i32> %x) { |
| 24 | +; CHECK-LABEL: define <8 x i32> @concat_extract_subvectors_undef( |
| 25 | +; CHECK-SAME: <8 x i32> [[X:%.*]]) #[[ATTR0]] { |
| 26 | +; CHECK-NEXT: [[LO:%.*]] = shufflevector <8 x i32> [[X]], <8 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 8> |
| 27 | +; CHECK-NEXT: [[HI:%.*]] = shufflevector <8 x i32> [[X]], <8 x i32> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 8> |
| 28 | +; CHECK-NEXT: [[CONCAT:%.*]] = shufflevector <4 x i32> [[LO]], <4 x i32> [[HI]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 29 | +; CHECK-NEXT: ret <8 x i32> [[CONCAT]] |
| 30 | +; |
| 31 | + %lo = shufflevector <8 x i32> %x, <8 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 8> |
| 32 | + %hi = shufflevector <8 x i32> %x, <8 x i32> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 8> |
| 33 | + %concat = shufflevector <4 x i32> %lo, <4 x i32> %hi, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 34 | + ret <8 x i32> %concat |
| 35 | +} |
| 36 | + |
| 37 | +; negative test - shuffle contains poision |
| 38 | + |
| 39 | +define <8 x i32> @concat_extract_subvectors_poison(<8 x i32> %x) { |
| 40 | +; CHECK-LABEL: define <8 x i32> @concat_extract_subvectors_poison( |
| 41 | +; CHECK-SAME: <8 x i32> [[X:%.*]]) #[[ATTR0]] { |
| 42 | +; CHECK-NEXT: [[LO:%.*]] = shufflevector <8 x i32> [[X]], <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 8> |
| 43 | +; CHECK-NEXT: [[HI:%.*]] = shufflevector <8 x i32> [[X]], <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 8> |
| 44 | +; CHECK-NEXT: [[CONCAT:%.*]] = shufflevector <4 x i32> [[LO]], <4 x i32> [[HI]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 45 | +; CHECK-NEXT: ret <8 x i32> [[CONCAT]] |
| 46 | +; |
| 47 | + %lo = shufflevector <8 x i32> %x, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 8> |
| 48 | + %hi = shufflevector <8 x i32> %x, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 8> |
| 49 | + %concat = shufflevector <4 x i32> %lo, <4 x i32> %hi, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 50 | + ret <8 x i32> %concat |
| 51 | +} |
0 commit comments