|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | +; RUN: opt < %s -passes=instsimplify -S | FileCheck %s |
| 3 | + |
| 4 | +define <vscale x 4 x i32> @rev_of_rev(<vscale x 4 x i32> %a, i32 %evl) { |
| 5 | +; CHECK-LABEL: @rev_of_rev( |
| 6 | +; CHECK-NEXT: [[A_REV:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[A:%.*]], <vscale x 4 x i1> splat (i1 true), i32 [[EVL:%.*]]) |
| 7 | +; CHECK-NEXT: [[RES:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[A_REV]], <vscale x 4 x i1> splat (i1 true), i32 [[EVL]]) |
| 8 | +; CHECK-NEXT: ret <vscale x 4 x i32> [[RES]] |
| 9 | +; |
| 10 | + %a.rev = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse(<vscale x 4 x i32> %a, <vscale x 4 x i1> splat (i1 true), i32 %evl) |
| 11 | + %res = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse(<vscale x 4 x i32> %a.rev, <vscale x 4 x i1> splat (i1 true), i32 %evl) |
| 12 | + ret <vscale x 4 x i32> %res |
| 13 | +} |
| 14 | + |
| 15 | +define <vscale x 4 x i32> @rev_of_rev_diffevl(<vscale x 4 x i32> %a, i32 %evl) { |
| 16 | +; CHECK-LABEL: @rev_of_rev_diffevl( |
| 17 | +; CHECK-NEXT: [[A_REV:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[A:%.*]], <vscale x 4 x i1> splat (i1 true), i32 [[EVL:%.*]]) |
| 18 | +; CHECK-NEXT: [[RES:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[A_REV]], <vscale x 4 x i1> splat (i1 true), i32 10) |
| 19 | +; CHECK-NEXT: ret <vscale x 4 x i32> [[RES]] |
| 20 | +; |
| 21 | + %a.rev = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse(<vscale x 4 x i32> %a, <vscale x 4 x i1> splat (i1 true), i32 %evl) |
| 22 | + %res = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse(<vscale x 4 x i32> %a.rev, <vscale x 4 x i1> splat (i1 true), i32 10) |
| 23 | + ret <vscale x 4 x i32> %res |
| 24 | +} |
| 25 | + |
| 26 | +define <vscale x 4 x i32> @rev_of_poison(i32 %evl) { |
| 27 | +; CHECK-LABEL: @rev_of_poison( |
| 28 | +; CHECK-NEXT: [[REV:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> poison, <vscale x 4 x i1> splat (i1 true), i32 [[EVL:%.*]]) |
| 29 | +; CHECK-NEXT: ret <vscale x 4 x i32> [[REV]] |
| 30 | +; |
| 31 | + %rev = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse(<vscale x 4 x i32> poison, <vscale x 4 x i1> splat (i1 true), i32 %evl) |
| 32 | + ret <vscale x 4 x i32> %rev |
| 33 | +} |
| 34 | + |
| 35 | +define <vscale x 4 x i32> @rev_of_undef(i32 %evl) { |
| 36 | +; CHECK-LABEL: @rev_of_undef( |
| 37 | +; CHECK-NEXT: [[REV:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> undef, <vscale x 4 x i1> splat (i1 true), i32 [[EVL:%.*]]) |
| 38 | +; CHECK-NEXT: ret <vscale x 4 x i32> [[REV]] |
| 39 | +; |
| 40 | + %rev = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse(<vscale x 4 x i32> undef, <vscale x 4 x i1> splat (i1 true), i32 %evl) |
| 41 | + ret <vscale x 4 x i32> %rev |
| 42 | +} |
| 43 | + |
| 44 | +define <vscale x 4 x i32> @rev_of_zero(i32 %evl) { |
| 45 | +; CHECK-LABEL: @rev_of_zero( |
| 46 | +; CHECK-NEXT: [[REV:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x i1> splat (i1 true), i32 [[EVL:%.*]]) |
| 47 | +; CHECK-NEXT: ret <vscale x 4 x i32> [[REV]] |
| 48 | +; |
| 49 | + %rev = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x i1> splat (i1 true), i32 %evl) |
| 50 | + ret <vscale x 4 x i32> %rev |
| 51 | +} |
| 52 | + |
| 53 | +define <vscale x 4 x i32> @rev_of_splat(i32 %a, i32 %evl) { |
| 54 | +; CHECK-LABEL: @rev_of_splat( |
| 55 | +; CHECK-NEXT: [[A_INS:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[A:%.*]], i32 0 |
| 56 | +; CHECK-NEXT: [[A_VEC:%.*]] = shufflevector <vscale x 4 x i32> [[A_INS]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer |
| 57 | +; CHECK-NEXT: [[REV:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[A_VEC]], <vscale x 4 x i1> splat (i1 true), i32 [[EVL:%.*]]) |
| 58 | +; CHECK-NEXT: ret <vscale x 4 x i32> [[REV]] |
| 59 | +; |
| 60 | + %a.ins = insertelement <vscale x 4 x i32> poison, i32 %a, i32 0 |
| 61 | + %a.vec = shufflevector <vscale x 4 x i32> %a.ins, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer |
| 62 | + %rev = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse(<vscale x 4 x i32> %a.vec, <vscale x 4 x i1> splat (i1 true), i32 %evl) |
| 63 | + ret <vscale x 4 x i32> %rev |
| 64 | +} |
| 65 | + |
| 66 | +define <vscale x 4 x i32> @rev_of_splat2(i32 %a, <vscale x 4 x i1> %m, i32 %evl) { |
| 67 | +; CHECK-LABEL: @rev_of_splat2( |
| 68 | +; CHECK-NEXT: [[A_INS:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[A:%.*]], i32 0 |
| 69 | +; CHECK-NEXT: [[A_VEC:%.*]] = shufflevector <vscale x 4 x i32> [[A_INS]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer |
| 70 | +; CHECK-NEXT: [[REV:%.*]] = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[A_VEC]], <vscale x 4 x i1> [[M:%.*]], i32 [[EVL:%.*]]) |
| 71 | +; CHECK-NEXT: ret <vscale x 4 x i32> [[REV]] |
| 72 | +; |
| 73 | + %a.ins = insertelement <vscale x 4 x i32> poison, i32 %a, i32 0 |
| 74 | + %a.vec = shufflevector <vscale x 4 x i32> %a.ins, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer |
| 75 | + %rev = tail call <vscale x 4 x i32> @llvm.experimental.vp.reverse(<vscale x 4 x i32> %a.vec, <vscale x 4 x i1> %m, i32 %evl) |
| 76 | + ret <vscale x 4 x i32> %rev |
| 77 | +} |
0 commit comments