|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6 |
| 2 | +; RUN: opt -S -mtriple=amdgcn-- -mcpu=gfx1250 -passes=vector-combine < %s | FileCheck -check-prefix=OPT %s |
| 3 | + |
| 4 | +define <8 x i8> @extending0(<8 x i8> %a, <4 x i8> %b) { |
| 5 | +; OPT-LABEL: define <8 x i8> @extending0( |
| 6 | +; OPT-SAME: <8 x i8> [[A:%.*]], <4 x i8> [[B:%.*]]) #[[ATTR0:[0-9]+]] { |
| 7 | +; OPT-NEXT: [[EXT0:%.*]] = shufflevector <4 x i8> [[B]], <4 x i8> [[B]], <8 x i32> <i32 poison, i32 poison, i32 3, i32 poison, i32 poison, i32 4, i32 poison, i32 poison> |
| 8 | +; OPT-NEXT: [[EXT1:%.*]] = shufflevector <4 x i8> poison, <4 x i8> [[B]], <8 x i32> <i32 4, i32 poison, i32 7, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison> |
| 9 | +; OPT-NEXT: [[MERGE0:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> [[EXT0]], <8 x i32> <i32 10, i32 1, i32 2, i32 3, i32 13, i32 5, i32 6, i32 7> |
| 10 | +; OPT-NEXT: [[MERGE1:%.*]] = shufflevector <8 x i8> [[EXT1]], <8 x i8> [[MERGE0]], <8 x i32> <i32 0, i32 8, i32 2, i32 9, i32 10, i32 11, i32 12, i32 13> |
| 11 | +; OPT-NEXT: ret <8 x i8> [[MERGE1]] |
| 12 | +; |
| 13 | + %ext0 = shufflevector <4 x i8> %b, <4 x i8> %b, <8 x i32> <i32 poison, i32 poison, i32 3, i32 poison, i32 poison, i32 4, i32 poison, i32 poison> |
| 14 | + %ext1 = shufflevector <4 x i8> poison, <4 x i8> %b, <8 x i32> <i32 4, i32 poison, i32 7, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison> |
| 15 | + %merge0 = shufflevector <8 x i8> %a, <8 x i8> %ext0, <8 x i32> <i32 10, i32 1, i32 2, i32 3, i32 13, i32 5, i32 6, i32 7> |
| 16 | + %merge1 = shufflevector <8 x i8> %ext1, <8 x i8> %merge0, <8 x i32> <i32 0, i32 8, i32 2, i32 9, i32 10, i32 11, i32 12, i32 13> |
| 17 | + ret <8 x i8> %merge1 |
| 18 | +} |
| 19 | + |
| 20 | +define <8 x i8> @extending_conflict(<8 x i8> %a, <4 x i8> %b) { |
| 21 | +; OPT-LABEL: define <8 x i8> @extending_conflict( |
| 22 | +; OPT-SAME: <8 x i8> [[A:%.*]], <4 x i8> [[B:%.*]]) #[[ATTR0]] { |
| 23 | +; OPT-NEXT: [[EXT0:%.*]] = shufflevector <4 x i8> [[B]], <4 x i8> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison> |
| 24 | +; OPT-NEXT: [[EXT1:%.*]] = shufflevector <4 x i8> [[B]], <4 x i8> poison, <8 x i32> <i32 0, i32 2, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison> |
| 25 | +; OPT-NEXT: [[MERGE0:%.*]] = shufflevector <8 x i8> [[A]], <8 x i8> [[EXT0]], <8 x i32> <i32 10, i32 1, i32 2, i32 3, i32 15, i32 5, i32 6, i32 7> |
| 26 | +; OPT-NEXT: [[MERGE1:%.*]] = shufflevector <8 x i8> [[EXT1]], <8 x i8> [[MERGE0]], <8 x i32> <i32 0, i32 8, i32 2, i32 9, i32 10, i32 11, i32 12, i32 13> |
| 27 | +; OPT-NEXT: ret <8 x i8> [[MERGE1]] |
| 28 | +; |
| 29 | + %ext0 = shufflevector <4 x i8> %b, <4 x i8> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison> |
| 30 | + %ext1 = shufflevector <4 x i8> %b, <4 x i8> poison, <8 x i32> <i32 0, i32 2, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison> |
| 31 | + %merge0 = shufflevector <8 x i8> %a, <8 x i8> %ext0, <8 x i32> <i32 10, i32 1, i32 2, i32 3, i32 15, i32 5, i32 6, i32 7> |
| 32 | + %merge1 = shufflevector <8 x i8> %ext1, <8 x i8> %merge0, <8 x i32> <i32 0, i32 8, i32 2, i32 9, i32 10, i32 11, i32 12, i32 13> |
| 33 | + ret <8 x i8> %merge1 |
| 34 | +} |
| 35 | + |
| 36 | +define <4 x i8> @shrinking0(<4 x i8> %a, <8 x i8> %b) { |
| 37 | +; OPT-LABEL: define <4 x i8> @shrinking0( |
| 38 | +; OPT-SAME: <4 x i8> [[A:%.*]], <8 x i8> [[B:%.*]]) #[[ATTR0]] { |
| 39 | +; OPT-NEXT: [[SHRINK0:%.*]] = shufflevector <8 x i8> [[B]], <8 x i8> [[B]], <4 x i32> <i32 poison, i32 7, i32 8, i32 poison> |
| 40 | +; OPT-NEXT: [[SHRINK1:%.*]] = shufflevector <8 x i8> poison, <8 x i8> [[B]], <4 x i32> <i32 poison, i32 poison, i32 8, i32 9> |
| 41 | +; OPT-NEXT: [[MERGE0:%.*]] = shufflevector <4 x i8> [[A]], <4 x i8> [[SHRINK0]], <4 x i32> <i32 5, i32 6, i32 0, i32 1> |
| 42 | +; OPT-NEXT: [[MERGE1:%.*]] = shufflevector <4 x i8> [[MERGE0]], <4 x i8> [[SHRINK1]], <4 x i32> <i32 0, i32 2, i32 6, i32 7> |
| 43 | +; OPT-NEXT: ret <4 x i8> [[MERGE1]] |
| 44 | +; |
| 45 | + %shrink0 = shufflevector <8 x i8> %b, <8 x i8> %b, <4 x i32> <i32 poison, i32 7, i32 8, i32 poison> |
| 46 | + %shrink1 = shufflevector <8 x i8> poison, <8 x i8> %b, <4 x i32> <i32 poison, i32 poison, i32 8, i32 9> |
| 47 | + %merge0 = shufflevector <4 x i8> %a, <4 x i8> %shrink0, <4 x i32> <i32 5, i32 6, i32 0, i32 1> |
| 48 | + %merge1 = shufflevector <4 x i8> %merge0, <4 x i8> %shrink1, <4 x i32> <i32 0, i32 2, i32 6, i32 7> |
| 49 | + ret <4 x i8> %merge1 |
| 50 | +} |
0 commit comments