1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -passes=instsimplify -S < %s | FileCheck %s 3 4; Test back to back reverse shuffles are eliminated. 5define <vscale x 4 x i32> @shuffle_b2b_reverse(<vscale x 4 x i32> %a) { 6; CHECK-LABEL: @shuffle_b2b_reverse( 7; CHECK-NEXT: ret <vscale x 4 x i32> [[A:%.*]] 8; 9 %rev = tail call <vscale x 4 x i32> @llvm.vector.reverse.nxv4i32(<vscale x 4 x i32> %a) 10 %rev.rev = tail call <vscale x 4 x i32> @llvm.vector.reverse.nxv4i32(<vscale x 4 x i32> %rev) 11 ret <vscale x 4 x i32> %rev.rev 12} 13 14; Test reverse of a splat is eliminated. 15define <vscale x 4 x i32> @splat_reverse(i32 %a) { 16; CHECK-LABEL: @splat_reverse( 17; CHECK-NEXT: [[SPLAT_INSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[A:%.*]], i32 0 18; CHECK-NEXT: [[SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[SPLAT_INSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer 19; CHECK-NEXT: ret <vscale x 4 x i32> [[SPLAT]] 20; 21 %splat_insert = insertelement <vscale x 4 x i32> poison, i32 %a, i32 0 22 %splat = shufflevector <vscale x 4 x i32> %splat_insert, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer 23 %rev = tail call <vscale x 4 x i32> @llvm.vector.reverse.nxv4i32(<vscale x 4 x i32> %splat) 24 ret <vscale x 4 x i32> %rev 25} 26 27declare <vscale x 4 x i32> @llvm.vector.reverse.nxv4i32(<vscale x 4 x i32>) 28