51 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=aggressive-instcombine -S | FileCheck %s3 4; Use the same idoim as X86/or-load.ll @loadCombine_2consecutive to represent a5; sequence of operations that can be replaced by a single double-width load when6; using scalar types but whose logic does not apply to fixed length vectors.7define <8 x i16> @or-load-fixed-length-vector(ptr %p1) {8; CHECK-LABEL: @or-load-fixed-length-vector(9; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, ptr [[P1:%.*]], i32 110; CHECK-NEXT: [[L1:%.*]] = load <8 x i8>, ptr [[P1]], align 111; CHECK-NEXT: [[L2:%.*]] = load <8 x i8>, ptr [[P2]], align 112; CHECK-NEXT: [[E1:%.*]] = zext <8 x i8> [[L1]] to <8 x i16>13; CHECK-NEXT: [[E2:%.*]] = zext <8 x i8> [[L2]] to <8 x i16>14; CHECK-NEXT: [[S2:%.*]] = shl <8 x i16> [[E2]], splat (i16 8)15; CHECK-NEXT: [[OR:%.*]] = or <8 x i16> [[E1]], [[S2]]16; CHECK-NEXT: ret <8 x i16> [[OR]]17;18 %p2 = getelementptr i8, ptr %p1, i32 119 %l1 = load <8 x i8>, ptr %p1, align 120 %l2 = load <8 x i8>, ptr %p2, align 121 %e1 = zext <8 x i8> %l1 to <8 x i16>22 %e2 = zext <8 x i8> %l2 to <8 x i16>23 %s2 = shl <8 x i16> %e2, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>24 %or = or <8 x i16> %e1, %s225 ret <8 x i16> %or26}27 28; Use the same idoim as X86/or-load.ll @loadCombine_2consecutive to represent a29; sequence of operations that can be replaced by a single double-width load when30; using scalar types but whose logic does not apply to scalable length vectors.31define <vscale x 8 x i16> @or-load-scalable-vector(ptr %p1) {32; CHECK-LABEL: @or-load-scalable-vector(33; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, ptr [[P1:%.*]], i32 134; CHECK-NEXT: [[L1:%.*]] = load <vscale x 8 x i8>, ptr [[P1]], align 135; CHECK-NEXT: [[L2:%.*]] = load <vscale x 8 x i8>, ptr [[P2]], align 136; CHECK-NEXT: [[E1:%.*]] = zext <vscale x 8 x i8> [[L1]] to <vscale x 8 x i16>37; CHECK-NEXT: [[E2:%.*]] = zext <vscale x 8 x i8> [[L2]] to <vscale x 8 x i16>38; CHECK-NEXT: [[S2:%.*]] = shl <vscale x 8 x i16> [[E2]], splat (i16 8)39; CHECK-NEXT: [[OR:%.*]] = or <vscale x 8 x i16> [[E1]], [[S2]]40; CHECK-NEXT: ret <vscale x 8 x i16> [[OR]]41;42 %p2 = getelementptr i8, ptr %p1, i32 143 %l1 = load <vscale x 8 x i8>, ptr %p1, align 144 %l2 = load <vscale x 8 x i8>, ptr %p2, align 145 %e1 = zext <vscale x 8 x i8> %l1 to <vscale x 8 x i16>46 %e2 = zext <vscale x 8 x i8> %l2 to <vscale x 8 x i16>47 %s2 = shl <vscale x 8 x i16> %e2, splat (i16 8)48 %or = or <vscale x 8 x i16> %e1, %s249 ret <vscale x 8 x i16> %or50}51