Skip to contentSkip to conversation

Add patterns for SVE2

PATCH Superseded Stephen Long 1 participant 5 messages May 19, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add patterns for SVE2

I'm working with Richard on SVE2 support for QEMU. I added some patterns to risu so we can start testing our implementation. I'm not sure I'm doing it correctly, so it would be great to get some eyes on it.

I sent Peter and Richard v1 of this patch series, but I think I should be sending these to the mailing list. This version of the patch series includes one more patch.

Stephen Long (4):
sve2.risu: Add patterns for floating-point pairwise ops sve2.risu: Add patterns for integer multiply (unpredicated) sve2.risu: Add patterns for integer (predicated) ops sve2.risu: Add patterns for widening integer arithmetic

 sve2.risu | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)
 create mode 100755 sve2.risu
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 sve2.risu: Add patterns for floating-point pairwise ops

---
 sve2.risu | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100755 sve2.risu
sve2.risu new file +14 -0
new file mode 100755
index 0000000..eb1d75a
@@ -0,0 +1,14 @@
+# Input file for risugen defining AArch64 SVE2 instructions
+.mode arm.aarch64
+
+# floating-point pairwise
+FADDP       A64_V    01100100 size:2 010 000 100 pg:3 zm:5 zdn:5 \
+!constraints { $size != 0; }
+FMAXNMP     A64_V    01100100 size:2 010 100 100 pg:3 zm:5 zdn:5 \
+!constraints { $size != 0; }
+FMINNMP     A64_V    01100100 size:2 010 101 100 pg:3 zm:5 zdn:5 \
+!constraints { $size != 0; }
+FMAXP       A64_V    01100100 size:2 010 110 100 pg:3 zm:5 zdn:5 \
+!constraints { $size != 0; }
+FMINP       A64_V    01100100 size:2 010 111 100 pg:3 zm:5 zdn:5 \
+!constraints { $size != 0; }
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 sve2.risu: Add patterns for integer multiply (unpredicated)

In reply to Stephen Long
---
 sve2.risu | 11 +++++++++++
 1 file changed, 11 insertions(+)
sve2.risu +11 -0
index eb1d75a..ccdb19f 100755
@@ -1,6 +1,17 @@
 # Input file for risugen defining AArch64 SVE2 instructions
 .mode arm.aarch64
 
+# integer multiply vectors (unpredicated)
+MUL         A64_V    00000100 size:2 1 zm:5 0110 00 zn:5 zd:5
+SMULH       A64_V    00000100 size:2 1 zm:5 0110 10 zn:5 zd:5
+UMULH       A64_V    00000100 size:2 1 zm:5 0110 11 zn:5 zd:5
+PMUL        A64_V    00000100 size:2 1 zm:5 0110 01 zn:5 zd:5 \
+!constraints { $size == 0; }
+
+# signed saturating doubling multiply high (unpredicated)
+SQDMULH     A64_V    00000100 size:2 1 zm:5 01110 0 zn:5 zd:5
+SQRDMULH    A64_V    00000100 size:2 1 zm:5 01110 1 zn:5 zd:5
+
 # floating-point pairwise
 FADDP       A64_V    01100100 size:2 010 000 100 pg:3 zm:5 zdn:5 \
 !constraints { $size != 0; }
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/4 sve2.risu: Add patterns for integer (predicated) ops

In reply to Stephen Long
---
 sve2.risu | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
sve2.risu +55 -0
index ccdb19f..9e48e1e 100755
@@ -12,6 +12,61 @@ PMUL        A64_V    00000100 size:2 1 zm:5 0110 01 zn:5 zd:5 \
 SQDMULH     A64_V    00000100 size:2 1 zm:5 01110 0 zn:5 zd:5
 SQRDMULH    A64_V    00000100 size:2 1 zm:5 01110 1 zn:5 zd:5
 
+# integer pairwise add and accumulate long
+SADALP      A64_V    01000100 size:2 00010 0 101 pg:3 zn:5 zda:5 \
+!constraints { $size != 0; }
+UADALP      A64_V    01000100 size:2 00010 1 101 pg:3 zn:5 zda:5 \
+!constraints { $size != 0; }
+
+# integer unary (predicated)
+URECPE      A64_V    01000100 size:2 00 0 0 00 101 pg:3 zn:5 zda:5 \
+!constraints { $size == 2; }
+URSQRTE     A64_V    01000100 size:2 00 0 0 01 101 pg:3 zn:5 zda:5 \
+!constraints { $size == 2; }
+SQABS       A64_V    01000100 size:2 00 1 0 00 101 pg:3 zn:5 zda:5
+SQNEG       A64_V    01000100 size:2 00 1 0 01 101 pg:3 zn:5 zda:5
+
+# saturating/rounding bitwise shift left (predicated)
+SRSHL       A64_V    01000100 size:2 00 0010 100 pg:3 zm:5 zdn:5
+URSHL       A64_V    01000100 size:2 00 0011 100 pg:3 zm:5 zdn:5
+SRSHLR      A64_V    01000100 size:2 00 0110 100 pg:3 zm:5 zdn:5
+URSHLR      A64_V    01000100 size:2 00 0111 100 pg:3 zm:5 zdn:5
+SQSHL       A64_V    01000100 size:2 00 1000 100 pg:3 zm:5 zdn:5
+UQSHL       A64_V    01000100 size:2 00 1001 100 pg:3 zm:5 zdn:5
+SQRSHL      A64_V    01000100 size:2 00 1010 100 pg:3 zm:5 zdn:5
+UQRSHL      A64_V    01000100 size:2 00 1011 100 pg:3 zm:5 zdn:5
+SQSHLR      A64_V    01000100 size:2 00 1100 100 pg:3 zm:5 zdn:5
+UQSHLR      A64_V    01000100 size:2 00 1101 100 pg:3 zm:5 zdn:5
+SQRSHLR     A64_V    01000100 size:2 00 1110 100 pg:3 zm:5 zdn:5
+UQRSHLR     A64_V    01000100 size:2 00 1111 100 pg:3 zm:5 zdn:5
+
+# integer halving add/subtract (predicated)
+SHADD       A64_V    01000100 size:2 010 000 100 pg:3 zm:5 zdn:5
+UHADD       A64_V    01000100 size:2 010 001 100 pg:3 zm:5 zdn:5
+SHSUB       A64_V    01000100 size:2 010 010 100 pg:3 zm:5 zdn:5
+UHSUB       A64_V    01000100 size:2 010 011 100 pg:3 zm:5 zdn:5
+SRHADD      A64_V    01000100 size:2 010 100 100 pg:3 zm:5 zdn:5
+URHADD      A64_V    01000100 size:2 010 101 100 pg:3 zm:5 zdn:5
+SHSUBR      A64_V    01000100 size:2 010 110 100 pg:3 zm:5 zdn:5
+UHSUBR      A64_V    01000100 size:2 010 111 100 pg:3 zm:5 zdn:5
+
+# integer pairwise arithmetic
+ADDP        A64_V    01000100 size:2 010 001 101 pg:3 zm:5 zdn:5
+SMAXP       A64_V    01000100 size:2 010 100 101 pg:3 zm:5 zdn:5
+UMAXP       A64_V    01000100 size:2 010 101 101 pg:3 zm:5 zdn:5
+SMINP       A64_V    01000100 size:2 010 110 101 pg:3 zm:5 zdn:5
+UMINP       A64_V    01000100 size:2 010 111 101 pg:3 zm:5 zdn:5
+
+# saturating add/subtract
+SQADD       A64_V    01000100 size:2 011 000 100 pg:3 zm:5 zdn:5
+UQADD       A64_V    01000100 size:2 011 001 100 pg:3 zm:5 zdn:5
+SQSUB       A64_V    01000100 size:2 011 010 100 pg:3 zm:5 zdn:5
+UQSUB       A64_V    01000100 size:2 011 011 100 pg:3 zm:5 zdn:5
+SUQADD      A64_V    01000100 size:2 011 100 100 pg:3 zm:5 zdn:5
+USQADD      A64_V    01000100 size:2 011 101 100 pg:3 zm:5 zdn:5
+SQSUBR      A64_V    01000100 size:2 011 110 100 pg:3 zm:5 zdn:5
+UQSUBR      A64_V    01000100 size:2 011 111 100 pg:3 zm:5 zdn:5
+
 # floating-point pairwise
 FADDP       A64_V    01100100 size:2 010 000 100 pg:3 zm:5 zdn:5 \
 !constraints { $size != 0; }
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/4 sve2.risu: Add patterns for widening integer arithmetic

In reply to Stephen Long
---
 sve2.risu | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
sve2.risu +62 -0
index 9e48e1e..a4d5312 100755
@@ -67,6 +67,68 @@ USQADD      A64_V    01000100 size:2 011 101 100 pg:3 zm:5 zdn:5
 SQSUBR      A64_V    01000100 size:2 011 110 100 pg:3 zm:5 zdn:5
 UQSUBR      A64_V    01000100 size:2 011 111 100 pg:3 zm:5 zdn:5
 
+# integer add/subtract long
+SADDLB      A64_V    01000101 size:2 0 zm:5 00 0000 zn:5 zd:5 \
+!constraints { $size != 0; }
+SADDLT      A64_V    01000101 size:2 0 zm:5 00 0001 zn:5 zd:5 \
+!constraints { $size != 0; }
+UADDLB      A64_V    01000101 size:2 0 zm:5 00 0010 zn:5 zd:5 \
+!constraints { $size != 0; }
+UADDLT      A64_V    01000101 size:2 0 zm:5 00 0011 zn:5 zd:5 \
+!constraints { $size != 0; }
+SSUBLB      A64_V    01000101 size:2 0 zm:5 00 0100 zn:5 zd:5 \
+!constraints { $size != 0; }
+SSUBLT      A64_V    01000101 size:2 0 zm:5 00 0101 zn:5 zd:5 \
+!constraints { $size != 0; }
+USUBLB      A64_V    01000101 size:2 0 zm:5 00 0110 zn:5 zd:5 \
+!constraints { $size != 0; }
+USUBLT      A64_V    01000101 size:2 0 zm:5 00 0111 zn:5 zd:5 \
+!constraints { $size != 0; }
+SABDLB      A64_V    01000101 size:2 0 zm:5 00 1100 zn:5 zd:5 \
+!constraints { $size != 0; }
+SABDLT      A64_V    01000101 size:2 0 zm:5 00 1101 zn:5 zd:5 \
+!constraints { $size != 0; }
+UABDLB      A64_V    01000101 size:2 0 zm:5 00 1110 zn:5 zd:5 \
+!constraints { $size != 0; }
+UABDLT      A64_V    01000101 size:2 0 zm:5 00 1111 zn:5 zd:5 \
+!constraints { $size != 0; }
+
+# integer add/subtract wide
+SADDWB      A64_V    01000101 size:2 0 zm:5 010 000 zn:5 zd:5 \
+!constraints { $size != 0; }
+SADDWT      A64_V    01000101 size:2 0 zm:5 010 001 zn:5 zd:5 \
+!constraints { $size != 0; }
+UADDWB      A64_V    01000101 size:2 0 zm:5 010 010 zn:5 zd:5 \
+!constraints { $size != 0; }
+UADDWT      A64_V    01000101 size:2 0 zm:5 010 011 zn:5 zd:5 \
+!constraints { $size != 0; }
+SSUBWB      A64_V    01000101 size:2 0 zm:5 010 100 zn:5 zd:5 \
+!constraints { $size != 0; }
+SSUBWT      A64_V    01000101 size:2 0 zm:5 010 101 zn:5 zd:5 \
+!constraints { $size != 0; }
+USUBWB      A64_V    01000101 size:2 0 zm:5 010 110 zn:5 zd:5 \
+!constraints { $size != 0; }
+USUBWT      A64_V    01000101 size:2 0 zm:5 010 111 zn:5 zd:5 \
+!constraints { $size != 0; }
+
+# integer multiply long
+SQDMULLB    A64_V    01000101 size:2 0 zm:5 011 000 zn:5 zd:5 \
+!constraints { $size != 0; }
+SQDMULLT    A64_V    01000101 size:2 0 zm:5 011 001 zn:5 zd:5 \
+!constraints { $size != 0; }
+PMULLB      A64_V    01000101 size:2 0 zm:5 011 010 zn:5 zd:5 \
+!constraints { $size != 0; }
+PMULLT      A64_V    01000101 size:2 0 zm:5 011 011 zn:5 zd:5 \
+!constraints { $size != 0; }
+SMULLB      A64_V    01000101 size:2 0 zm:5 011 100 zn:5 zd:5 \
+!constraints { $size != 0; }
+SMULLT      A64_V    01000101 size:2 0 zm:5 011 101 zn:5 zd:5 \
+!constraints { $size != 0; }
+UMULLB      A64_V    01000101 size:2 0 zm:5 011 110 zn:5 zd:5 \
+!constraints { $size != 0; }
+UMULLT      A64_V    01000101 size:2 0 zm:5 011 111 zn:5 zd:5 \
+!constraints { $size != 0; }
+
 # floating-point pairwise
 FADDP       A64_V    01100100 size:2 010 000 100 pg:3 zm:5 zdn:5 \
 !constraints { $size != 0; }
Signature · 1 line
2.25.1