[PATCH] D66410: [ARM] Select vaddva
Sam Tebbs via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 03:39:58 PDT 2019
samtebbs created this revision.
samtebbs added reviewers: dmgreen, SjoerdMeijer, samparker, t.p.northover, olista01, simon_tatham.
Herald added subscribers: hiraditya, kristof.beyls, javed.absar.
Herald added a project: LLVM.
This patch adds vaddva selection.
https://reviews.llvm.org/D66410
Files:
llvm/lib/Target/ARM/ARMInstrMVE.td
llvm/test/CodeGen/Thumb2/mve-vaddv.ll
Index: llvm/test/CodeGen/Thumb2/mve-vaddv.ll
===================================================================
--- llvm/test/CodeGen/Thumb2/mve-vaddv.ll
+++ llvm/test/CodeGen/Thumb2/mve-vaddv.ll
@@ -1,6 +1,9 @@
; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve.fp %s -o - | FileCheck %s
declare i32 @llvm.experimental.vector.reduce.add.i32.v4i32(<4 x i32>)
+declare i16 @llvm.experimental.vector.reduce.add.i16.v8i16(<8 x i16>)
+declare i8 @llvm.experimental.vector.reduce.add.i8.v16i8(<16 x i8>)
+
define arm_aapcs_vfpcc i32 @vaddv_v4i32_i32(<4 x i32> %s1) {
; CHECK-LABEL: vaddv_v4i32_i32:
; CHECK: @ %bb.0: @ %entry
@@ -11,7 +14,6 @@
ret i32 %r
}
-declare i16 @llvm.experimental.vector.reduce.add.i16.v8i16(<8 x i16>)
define arm_aapcs_vfpcc i16 @vaddv_v16i16_i16(<8 x i16> %s1) {
; CHECK-LABEL: vaddv_v16i16_i16:
; CHECK: @ %bb.0: @ %entry
@@ -22,7 +24,6 @@
ret i16 %r
}
-declare i8 @llvm.experimental.vector.reduce.add.i8.v16i8(<16 x i8>)
define arm_aapcs_vfpcc i8 @vaddv_v16i8_i8(<16 x i8> %s1) {
; CHECK-LABEL: vaddv_v16i8_i8:
; CHECK: @ %bb.0: @ %entry
@@ -32,3 +33,36 @@
%r = call i8 @llvm.experimental.vector.reduce.add.i8.v16i8(<16 x i8> %s1)
ret i8 %r
}
+
+define arm_aapcs_vfpcc i32 @vaddva_v4i32_i32(<4 x i32> %s1, i32 %x) {
+; CHECK-LABEL: vaddva_v4i32_i32:
+; CHECK: @ %bb.0: @ %entry
+; CHECK-NEXT: vaddva.u32 r0, q0
+; CHECK-NEXT: bx lr
+entry:
+ %t = call i32 @llvm.experimental.vector.reduce.add.i32.v4i32(<4 x i32> %s1)
+ %r = add i32 %t, %x
+ ret i32 %r
+}
+
+define arm_aapcs_vfpcc i16 @vaddva_v8i16_i16(<8 x i16> %s1, i16 %x) {
+; CHECK-LABEL: vaddva_v8i16_i16:
+; CHECK: @ %bb.0: @ %entry
+; CHECK-NEXT: vaddva.u16 r0, q0
+; CHECK-NEXT: bx lr
+entry:
+ %t = call i16 @llvm.experimental.vector.reduce.add.i16.v8i16(<8 x i16> %s1)
+ %r = add i16 %t, %x
+ ret i16 %r
+}
+
+define arm_aapcs_vfpcc i8 @vaddva_v16i8_i8(<16 x i8> %s1, i8 %x) {
+; CHECK-LABEL: vaddva_v16i8_i8:
+; CHECK: @ %bb.0: @ %entry
+; CHECK-NEXT: vaddva.u8 r0, q0
+; CHECK-NEXT: bx lr
+entry:
+ %t = call i8 @llvm.experimental.vector.reduce.add.i8.v16i8(<16 x i8> %s1)
+ %r = add i8 %t, %x
+ ret i8 %r
+}
Index: llvm/lib/Target/ARM/ARMInstrMVE.td
===================================================================
--- llvm/lib/Target/ARM/ARMInstrMVE.td
+++ llvm/lib/Target/ARM/ARMInstrMVE.td
@@ -553,6 +553,13 @@
def : Pat<(i32 (vecreduce_add (v4i32 MQPR:$src))), (i32 (MVE_VADDVu32no_acc $src))>;
def : Pat<(i32 (vecreduce_add (v8i16 MQPR:$src))), (i32 (MVE_VADDVu16no_acc $src))>;
def : Pat<(i32 (vecreduce_add (v16i8 MQPR:$src))), (i32 (MVE_VADDVu8no_acc $src))>;
+ def : Pat<(i32 (add (i32 (vecreduce_add (v4i32 MQPR:$src1))), (i32 tGPR:$src2))),
+ (i32 (MVE_VADDVu32acc $src2, $src1))>;
+ def : Pat<(i32 (add (i32 (vecreduce_add (v8i16 MQPR:$src1))), (i32 tGPR:$src2))),
+ (i32 (MVE_VADDVu16acc $src2, $src1))>;
+ def : Pat<(i32 (add (i32 (vecreduce_add (v16i8 MQPR:$src1))), (i32 tGPR:$src2))),
+ (i32 (MVE_VADDVu8acc $src2, $src1))>;
+
}
class MVE_VADDLV<string iname, string suffix, dag iops, string cstr,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66410.215854.patch
Type: text/x-patch
Size: 3163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190819/b52614e6/attachment.bin>
More information about the llvm-commits
mailing list