]> granicus.if.org Git - llvm/commitdiff
[AArch64][SVE] Asm: add aliases for unpredicated bitwise logical instructions
authorCullen Rhodes <cullen.rhodes@arm.com>
Mon, 29 Apr 2019 15:27:27 +0000 (15:27 +0000)
committerCullen Rhodes <cullen.rhodes@arm.com>
Mon, 29 Apr 2019 15:27:27 +0000 (15:27 +0000)
This patch adds aliases for element sizes .B/.H/.S to the
AND/ORR/EOR/BIC bitwise logical instructions. The assembler now accepts
these instructions with all element sizes up to 64-bit (.D). The
preferred disassembly is .D.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359457 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64SVEInstrInfo.td
lib/Target/AArch64/SVEInstrFormats.td
test/MC/AArch64/SVE/and.s
test/MC/AArch64/SVE/bic.s
test/MC/AArch64/SVE/eor.s
test/MC/AArch64/SVE/orr.s

index 655caa3deb53f03424909d6ddf95729da2321328..1d099cbba98876bc3b3a1f9cf0aef2833bb6ba46 100644 (file)
@@ -25,10 +25,10 @@ let Predicates = [HasSVE] in {
   defm SQSUB_ZZZ : sve_int_bin_cons_arit_0<0b110, "sqsub">;
   defm UQSUB_ZZZ : sve_int_bin_cons_arit_0<0b111, "uqsub">;
 
-  def AND_ZZZ : sve_int_bin_cons_log<0b00, "and">;
-  def ORR_ZZZ : sve_int_bin_cons_log<0b01, "orr">;
-  def EOR_ZZZ : sve_int_bin_cons_log<0b10, "eor">;
-  def BIC_ZZZ : sve_int_bin_cons_log<0b11, "bic">;
+  defm AND_ZZZ : sve_int_bin_cons_log<0b00, "and">;
+  defm ORR_ZZZ : sve_int_bin_cons_log<0b01, "orr">;
+  defm EOR_ZZZ : sve_int_bin_cons_log<0b10, "eor">;
+  defm BIC_ZZZ : sve_int_bin_cons_log<0b11, "bic">;
 
   defm ADD_ZPmZ   : sve_int_bin_pred_arit_0<0b000, "add">;
   defm SUB_ZPmZ   : sve_int_bin_pred_arit_0<0b001, "sub">;
index 3a3efaa96ce600bf75458f72735d9d6cb32f0695..81c4e4c76e61a9071b51a189ba197f8c95e4e308 100644 (file)
@@ -1982,6 +1982,16 @@ class sve_int_bin_cons_log<bits<2> opc, string asm>
   let Inst{4-0}   = Zd;
 }
 
+multiclass sve_int_bin_cons_log<bits<2> opc, string asm> {
+  def NAME : sve_int_bin_cons_log<opc, asm>;
+
+  def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
+                  (!cast<Instruction>(NAME) ZPR8:$Zd,  ZPR8:$Zn,  ZPR8:$Zm),  1>;
+  def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
+                  (!cast<Instruction>(NAME) ZPR16:$Zd, ZPR16:$Zn, ZPR16:$Zm), 1>;
+  def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
+                  (!cast<Instruction>(NAME) ZPR32:$Zd, ZPR32:$Zn, ZPR32:$Zm), 1>;
+}
 
 //===----------------------------------------------------------------------===//
 // SVE Integer Wide Immediate - Predicated Group
index 0d0edc73e8f5594bef3691760436d7ab411b3bbf..0dc99ab2be9d6dacb1a43fa96891aca53309b487 100644 (file)
@@ -110,6 +110,28 @@ and     p15.b, p15/z, p15.b, p15.b
 // CHECK-UNKNOWN: ef 7d 0f 25 <unknown>
 
 
+// --------------------------------------------------------------------------//
+// Test aliases.
+
+and     z0.s, z0.s, z0.s
+// CHECK-INST: and     z0.d, z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0x20,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 20 04 <unknown>
+
+and     z0.h, z0.h, z0.h
+// CHECK-INST: and     z0.d, z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0x20,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 20 04 <unknown>
+
+and     z0.b, z0.b, z0.b
+// CHECK-INST: and     z0.d, z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0x20,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 20 04 <unknown>
+
+
 // --------------------------------------------------------------------------//
 // Test compatibility with MOVPRFX instruction.
 
index c9e6d9b8266567e71e3e9206c235444eee9f2930..064e295a9c6639e376f83417d0cc6d40de8661f4 100644 (file)
@@ -104,6 +104,28 @@ bic     p0.b, p0/z, p0.b, p0.b
 // CHECK-UNKNOWN: 10 40 00 25 <unknown>
 
 
+// --------------------------------------------------------------------------//
+// Test aliases.
+
+bic     z0.s, z0.s, z0.s
+// CHECK-INST: bic     z0.d, z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0xe0,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 e0 04 <unknown>
+
+bic     z0.h, z0.h, z0.h
+// CHECK-INST: bic     z0.d, z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0xe0,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 e0 04 <unknown>
+
+bic     z0.b, z0.b, z0.b
+// CHECK-INST: bic     z0.d, z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0xe0,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 e0 04 <unknown>
+
+
 // --------------------------------------------------------------------------//
 // Test compatibility with MOVPRFX instruction.
 
index f7b4247ad80b6ae59bbd3bbb576ff977596e04c8..e2c41ce5fed7d135fc5b0fef37f79dd5055253be 100644 (file)
@@ -110,6 +110,28 @@ eor     p15.b, p15/z, p15.b, p15.b
 // CHECK-UNKNOWN: ef 7f 0f 25 <unknown>
 
 
+// --------------------------------------------------------------------------//
+// Test aliases.
+
+eor     z0.s, z0.s, z0.s
+// CHECK-INST: eor     z0.d, z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0xa0,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 a0 04 <unknown>
+
+eor     z0.h, z0.h, z0.h
+// CHECK-INST: eor     z0.d, z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0xa0,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 a0 04 <unknown>
+
+eor     z0.b, z0.b, z0.b
+// CHECK-INST: eor     z0.d, z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0xa0,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 a0 04 <unknown>
+
+
 // --------------------------------------------------------------------------//
 // Test compatibility with MOVPRFX instruction.
 
index 7d00cd8c6cf1b9f2fabcbe805534bc8c03ecb0da..084587787ba0fd984df0c787a4d37689505291ce 100644 (file)
@@ -112,6 +112,46 @@ orr     p15.b, p15/z, p15.b, p15.b
 // CHECK-UNKNOWN: ef 7d 8f 25 <unknown>
 
 
+// --------------------------------------------------------------------------//
+// Test aliases.
+
+orr     z0.s, z0.s, z0.s
+// CHECK-INST: mov     z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0x60,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 60 04 <unknown>
+
+orr     z0.h, z0.h, z0.h
+// CHECK-INST: mov     z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0x60,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 60 04 <unknown>
+
+orr     z0.b, z0.b, z0.b
+// CHECK-INST: mov     z0.d, z0.d
+// CHECK-ENCODING: [0x00,0x30,0x60,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 30 60 04 <unknown>
+
+orr     z23.s, z13.s, z8.s  // should not use mov-alias
+// CHECK-INST: orr     z23.d, z13.d, z8.d
+// CHECK-ENCODING: [0xb7,0x31,0x68,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: b7 31 68 04 <unknown>
+
+orr     z23.h, z13.h, z8.h  // should not use mov-alias
+// CHECK-INST: orr     z23.d, z13.d, z8.d
+// CHECK-ENCODING: [0xb7,0x31,0x68,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: b7 31 68 04 <unknown>
+
+orr     z23.b, z13.b, z8.b  // should not use mov-alias
+// CHECK-INST: orr     z23.d, z13.d, z8.d
+// CHECK-ENCODING: [0xb7,0x31,0x68,0x04]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: b7 31 68 04 <unknown>
+
+
 // --------------------------------------------------------------------------//
 // Test compatibility with MOVPRFX instruction.