diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp --- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp @@ -126,6 +126,8 @@ .legalFor({v2s64}) .widenScalarToNextPow2(0) .clampScalar(0, s32, s64) + .clampMaxNumElements(0, s8, 16) + .clampMaxNumElements(0, s16, 8) .clampNumElements(0, v2s32, v4s32) .clampNumElements(0, v2s64, v2s64) .minScalarOrEltIf( diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-add.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-add.mir --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-add.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-add.mir @@ -163,6 +163,46 @@ $q0 = COPY %7(<2 x s64>) $q1 = COPY %8(<2 x s64>) +... +--- +name: test_vector_add_v16s16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_add_v16s16 + ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1 + ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<8 x s16>) = G_ADD [[COPY]], [[COPY]] + ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(<8 x s16>) = G_ADD [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[ADD]](<8 x s16>) + ; CHECK-NEXT: $q1 = COPY [[ADD1]](<8 x s16>) + %1:_(<8 x s16>) = COPY $q0 + %2:_(<8 x s16>) = COPY $q1 + %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>) + %3:_(<16 x s16>) = G_ADD %0, %0 + %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>) + $q0 = COPY %4(<8 x s16>) + $q1 = COPY %5(<8 x s16>) + +... +--- +name: test_vector_add_v32s8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_add_v32s8 + ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1 + ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<16 x s8>) = G_ADD [[COPY]], [[COPY]] + ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(<16 x s8>) = G_ADD [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[ADD]](<16 x s8>) + ; CHECK-NEXT: $q1 = COPY [[ADD1]](<16 x s8>) + %0:_(<16 x s8>) = COPY $q0 + %1:_(<16 x s8>) = COPY $q1 + %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1 + %3:_(<32 x s8>) = G_ADD %2, %2 + %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>) + $q0 = COPY %7(<16 x s8>) + $q1 = COPY %8(<16 x s8>) + ... --- name: test_vector_add_nonpow2 diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-and.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-and.mir --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-and.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-and.mir @@ -159,6 +159,46 @@ G_STORE %and(s318), %ptr(p0) :: (store (s318)) RET_ReallyLR implicit $x0 +... +--- +name: test_vector_and_v16s16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_and_v16s16 + ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(<8 x s16>) = G_AND [[COPY]], [[COPY]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(<8 x s16>) = G_AND [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[AND]](<8 x s16>) + ; CHECK-NEXT: $q1 = COPY [[AND1]](<8 x s16>) + %1:_(<8 x s16>) = COPY $q0 + %2:_(<8 x s16>) = COPY $q1 + %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>) + %3:_(<16 x s16>) = G_AND %0, %0 + %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>) + $q0 = COPY %4(<8 x s16>) + $q1 = COPY %5(<8 x s16>) + +... +--- +name: test_vector_and_v32s8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_and_v32s8 + ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1 + ; CHECK-NEXT: [[AND:%[0-9]+]]:_(<16 x s8>) = G_AND [[COPY]], [[COPY]] + ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(<16 x s8>) = G_AND [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[AND]](<16 x s8>) + ; CHECK-NEXT: $q1 = COPY [[AND1]](<16 x s8>) + %0:_(<16 x s8>) = COPY $q0 + %1:_(<16 x s8>) = COPY $q1 + %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1 + %3:_(<32 x s8>) = G_AND %2, %2 + %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>) + $q0 = COPY %7(<16 x s8>) + $q1 = COPY %8(<16 x s8>) + ... --- name: and_v2s1 diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir @@ -456,6 +456,46 @@ $q0 = COPY %mul(<4 x s32>) RET_ReallyLR implicit $q0 +... +--- +name: test_vector_mul_v16s16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_mul_v16s16 + ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1 + ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<8 x s16>) = G_MUL [[COPY]], [[COPY]] + ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(<8 x s16>) = G_MUL [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[MUL]](<8 x s16>) + ; CHECK-NEXT: $q1 = COPY [[MUL1]](<8 x s16>) + %1:_(<8 x s16>) = COPY $q0 + %2:_(<8 x s16>) = COPY $q1 + %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>) + %3:_(<16 x s16>) = G_MUL %0, %0 + %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>) + $q0 = COPY %4(<8 x s16>) + $q1 = COPY %5(<8 x s16>) + +... +--- +name: test_vector_mul_v32s8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_mul_v32s8 + ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1 + ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(<16 x s8>) = G_MUL [[COPY]], [[COPY]] + ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(<16 x s8>) = G_MUL [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[MUL]](<16 x s8>) + ; CHECK-NEXT: $q1 = COPY [[MUL1]](<16 x s8>) + %0:_(<16 x s8>) = COPY $q0 + %1:_(<16 x s8>) = COPY $q1 + %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1 + %3:_(<32 x s8>) = G_MUL %2, %2 + %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>) + $q0 = COPY %7(<16 x s8>) + $q1 = COPY %8(<16 x s8>) + ... --- name: mul_v2s1 diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-or.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-or.mir --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-or.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-or.mir @@ -99,6 +99,46 @@ G_STORE %or(s318), %ptr(p0) :: (store (s318)) RET_ReallyLR implicit $x0 +... +--- +name: test_vector_or_v16s16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_or_v16s16 + ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1 + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<8 x s16>) = G_OR [[COPY]], [[COPY]] + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(<8 x s16>) = G_OR [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[OR]](<8 x s16>) + ; CHECK-NEXT: $q1 = COPY [[OR1]](<8 x s16>) + %1:_(<8 x s16>) = COPY $q0 + %2:_(<8 x s16>) = COPY $q1 + %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>) + %3:_(<16 x s16>) = G_OR %0, %0 + %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>) + $q0 = COPY %4(<8 x s16>) + $q1 = COPY %5(<8 x s16>) + +... +--- +name: test_vector_or_v32s8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_or_v32s8 + ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1 + ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<16 x s8>) = G_OR [[COPY]], [[COPY]] + ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(<16 x s8>) = G_OR [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[OR]](<16 x s8>) + ; CHECK-NEXT: $q1 = COPY [[OR1]](<16 x s8>) + %0:_(<16 x s8>) = COPY $q0 + %1:_(<16 x s8>) = COPY $q1 + %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1 + %3:_(<32 x s8>) = G_OR %2, %2 + %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>) + $q0 = COPY %7(<16 x s8>) + $q1 = COPY %8(<16 x s8>) + ... --- name: or_v2s1 diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-sub.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-sub.mir --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-sub.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-sub.mir @@ -79,6 +79,46 @@ %5:_(s64) = G_ANYEXT %4(s8) $x0 = COPY %5(s64) +... +--- +name: test_vector_sub_v16s16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_sub_v16s16 + ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1 + ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<8 x s16>) = G_SUB [[COPY]], [[COPY]] + ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(<8 x s16>) = G_SUB [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[SUB]](<8 x s16>) + ; CHECK-NEXT: $q1 = COPY [[SUB1]](<8 x s16>) + %1:_(<8 x s16>) = COPY $q0 + %2:_(<8 x s16>) = COPY $q1 + %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>) + %3:_(<16 x s16>) = G_SUB %0, %0 + %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>) + $q0 = COPY %4(<8 x s16>) + $q1 = COPY %5(<8 x s16>) + +... +--- +name: test_vector_sub_v32s8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_sub_v32s8 + ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1 + ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<16 x s8>) = G_SUB [[COPY]], [[COPY]] + ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(<16 x s8>) = G_SUB [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[SUB]](<16 x s8>) + ; CHECK-NEXT: $q1 = COPY [[SUB1]](<16 x s8>) + %0:_(<16 x s8>) = COPY $q0 + %1:_(<16 x s8>) = COPY $q1 + %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1 + %3:_(<32 x s8>) = G_SUB %2, %2 + %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>) + $q0 = COPY %7(<16 x s8>) + $q1 = COPY %8(<16 x s8>) + ... --- name: sub_v2s1 diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-xor.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-xor.mir --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-xor.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-xor.mir @@ -146,6 +146,46 @@ G_STORE %xor(s158), %ptr(p0) :: (store (s158)) RET_ReallyLR implicit $x0 +... +--- +name: test_vector_xor_v16s16 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_xor_v16s16 + ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(<8 x s16>) = G_XOR [[COPY]], [[COPY]] + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(<8 x s16>) = G_XOR [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[XOR]](<8 x s16>) + ; CHECK-NEXT: $q1 = COPY [[XOR1]](<8 x s16>) + %1:_(<8 x s16>) = COPY $q0 + %2:_(<8 x s16>) = COPY $q1 + %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>) + %3:_(<16 x s16>) = G_XOR %0, %0 + %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>) + $q0 = COPY %4(<8 x s16>) + $q1 = COPY %5(<8 x s16>) + +... +--- +name: test_vector_xor_v32s8 +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_vector_xor_v32s8 + ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1 + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(<16 x s8>) = G_XOR [[COPY]], [[COPY]] + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(<16 x s8>) = G_XOR [[COPY1]], [[COPY1]] + ; CHECK-NEXT: $q0 = COPY [[XOR]](<16 x s8>) + ; CHECK-NEXT: $q1 = COPY [[XOR1]](<16 x s8>) + %0:_(<16 x s8>) = COPY $q0 + %1:_(<16 x s8>) = COPY $q1 + %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1 + %3:_(<32 x s8>) = G_XOR %2, %2 + %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>) + $q0 = COPY %7(<16 x s8>) + $q1 = COPY %8(<16 x s8>) + ... --- name: xor_v2s1