diff options
author | Danilo Carvalho Grael <danilo.carvalho.grael@huawei.com> | 2020-01-13 17:47:02 -0500 |
---|---|---|
committer | Danilo Carvalho Grael <danilo.carvalho.grael@huawei.com> | 2020-01-14 15:26:19 -0500 |
commit | 26d96126a0d258afccfeec1fbaa727bfeb820308 (patch) | |
tree | 3def53406f236b4902272e656802b0b726fc0295 /llvm/test/CodeGen/AArch64 | |
parent | 5d1b3ba687690bbb37f911f66a2c2c5f19d60032 (diff) | |
download | bcm5719-llvm-26d96126a0d258afccfeec1fbaa727bfeb820308.tar.gz bcm5719-llvm-26d96126a0d258afccfeec1fbaa727bfeb820308.zip |
[SVE] Add patterns for MUL immediate instruction.
Summary: Add the missing MUL pattern for integer immediate instructions.
Reviewers: sdesmalen, huntergr, efriedma, c-rhodes, kmclaughlin
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits, amehsan
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72654
Diffstat (limited to 'llvm/test/CodeGen/AArch64')
-rw-r--r-- | llvm/test/CodeGen/AArch64/sve-int-arith-imm.ll | 83 | ||||
-rw-r--r-- | llvm/test/CodeGen/AArch64/sve-neg-int-arith-imm-2.ll | 12 | ||||
-rw-r--r-- | llvm/test/CodeGen/AArch64/sve-neg-int-arith-imm.ll | 11 |
3 files changed, 106 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/sve-int-arith-imm.ll b/llvm/test/CodeGen/AArch64/sve-int-arith-imm.ll index ec87c27e8d8..451ddbbd876 100644 --- a/llvm/test/CodeGen/AArch64/sve-int-arith-imm.ll +++ b/llvm/test/CodeGen/AArch64/sve-int-arith-imm.ll @@ -363,3 +363,86 @@ define <vscale x 2 x i64> @umin_i64_large(<vscale x 2 x i64> %a) { %res = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %a, <vscale x 2 x i64> %splat ret <vscale x 2 x i64> %res } + +; +; MUL +; +define <vscale x 16 x i8> @mul_i8_neg(<vscale x 16 x i8> %a) { +; CHECK-LABEL: mul_i8_neg +; CHECK: mul z0.b, z0.b, #-17 +; CHECK-NEXT: ret + %elt = insertelement <vscale x 16 x i8> undef, i8 -17, i32 0 + %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer + %res = mul <vscale x 16 x i8> %a, %splat + ret <vscale x 16 x i8> %res +} + +define <vscale x 16 x i8> @mul_i8_pos(<vscale x 16 x i8> %a) { +; CHECK-LABEL: mul_i8_pos +; CHECK: mul z0.b, z0.b, #105 +; CHECK-NEXT: ret + %elt = insertelement <vscale x 16 x i8> undef, i8 105, i32 0 + %splat = shufflevector <vscale x 16 x i8> %elt, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer + %res = mul <vscale x 16 x i8> %a, %splat + ret <vscale x 16 x i8> %res +} + +define <vscale x 8 x i16> @mul_i16_neg(<vscale x 8 x i16> %a) { +; CHECK-LABEL: mul_i16_neg +; CHECK: mul z0.h, z0.h, #-17 +; CHECK-NEXT: ret + %elt = insertelement <vscale x 8 x i16> undef, i16 -17, i32 0 + %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer + %res = mul <vscale x 8 x i16> %a, %splat + ret <vscale x 8 x i16> %res +} + +define <vscale x 8 x i16> @mul_i16_pos(<vscale x 8 x i16> %a) { +; CHECK-LABEL: mul_i16_pos +; CHECK: mul z0.h, z0.h, #105 +; CHECK-NEXT: ret + %elt = insertelement <vscale x 8 x i16> undef, i16 105, i32 0 + %splat = shufflevector <vscale x 8 x i16> %elt, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer + %res = mul <vscale x 8 x i16> %a, %splat + ret <vscale x 8 x i16> %res +} + +define <vscale x 4 x i32> @mul_i32_neg(<vscale x 4 x i32> %a) { +; CHECK-LABEL: mul_i32_neg +; CHECK: mul z0.s, z0.s, #-17 +; CHECK-NEXT: ret + %elt = insertelement <vscale x 4 x i32> undef, i32 -17, i32 0 + %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer + %res = mul <vscale x 4 x i32> %a, %splat + ret <vscale x 4 x i32> %res +} + +define <vscale x 4 x i32> @mul_i32_pos(<vscale x 4 x i32> %a) { +; CHECK-LABEL: mul_i32_pos +; CHECK: mul z0.s, z0.s, #105 +; CHECK-NEXT: ret + %elt = insertelement <vscale x 4 x i32> undef, i32 105, i32 0 + %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer + %res = mul <vscale x 4 x i32> %a, %splat + ret <vscale x 4 x i32> %res +} + +define <vscale x 2 x i64> @mul_i64_neg(<vscale x 2 x i64> %a) { +; CHECK-LABEL: mul_i64_neg +; CHECK: mul z0.d, z0.d, #-17 +; CHECK-NEXT: ret + %elt = insertelement <vscale x 2 x i64> undef, i64 -17, i32 0 + %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer + %res = mul <vscale x 2 x i64> %a, %splat + ret <vscale x 2 x i64> %res +} + +define <vscale x 2 x i64> @mul_i64_pos(<vscale x 2 x i64> %a) { +; CHECK-LABEL: mul_i64_pos +; CHECK: mul z0.d, z0.d, #105 +; CHECK-NEXT: ret + %elt = insertelement <vscale x 2 x i64> undef, i64 105, i32 0 + %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer + %res = mul <vscale x 2 x i64> %a, %splat + ret <vscale x 2 x i64> %res +} diff --git a/llvm/test/CodeGen/AArch64/sve-neg-int-arith-imm-2.ll b/llvm/test/CodeGen/AArch64/sve-neg-int-arith-imm-2.ll new file mode 100644 index 00000000000..56d65425dd9 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve-neg-int-arith-imm-2.ll @@ -0,0 +1,12 @@ +; RUN: not llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s + +; Numbers smaller than -127 and greater than or equal to 127 are not allowed. +; This should get lowered to a regular vector multiply and these tests should +; be updated when those patterns are added. + +define <vscale x 2 x i64> @mul_i64_neg_1(<vscale x 2 x i64> %a) { + %elt = insertelement <vscale x 2 x i64> undef, i64 255, i32 0 + %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer + %res = mul <vscale x 2 x i64> %a, %splat + ret <vscale x 2 x i64> %res +} diff --git a/llvm/test/CodeGen/AArch64/sve-neg-int-arith-imm.ll b/llvm/test/CodeGen/AArch64/sve-neg-int-arith-imm.ll new file mode 100644 index 00000000000..992b1581559 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve-neg-int-arith-imm.ll @@ -0,0 +1,11 @@ +; RUN: not llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s + +; Numbers smaller than -127 and greater than or equal to 127 allowed for imm mul. +; This should get lowered to a regular vector multiply and these tests should +; be updated when those patterns are added. +define <vscale x 2 x i64> @mul_i64_neg_1(<vscale x 2 x i64> %a) { + %elt = insertelement <vscale x 2 x i64> undef, i64 -130, i32 0 + %splat = shufflevector <vscale x 2 x i64> %elt, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer + %res = mul <vscale x 2 x i64> %a, %splat + ret <vscale x 2 x i64> %res +} |