[llvm] r338029 - Enable some pointer authentication instructions for aarch64 v8a targets

Luke Cheeseman via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 26 07:00:50 PDT 2018


Author: lukecheeseman
Date: Thu Jul 26 07:00:50 2018
New Revision: 338029

URL: http://llvm.org/viewvc/llvm-project?rev=338029&view=rev
Log:
Enable some pointer authentication instructions for aarch64 v8a targets

- Some of the v8.3 pointer authentication instruction inhabit the Hint space
- These instructions can be assembled to hint instructions which act as NOP instructions prior to v8.3
- This patch permits using the hint instructions for all v8a targets
- Also, correct the RETA{A,B} instructions to match the instruction attributes of RET (set isTerminator and isBarrier)

Differential Revision: https://reviews.llvm.org/D49786



Modified:
    llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.td
    llvm/trunk/test/MC/AArch64/armv8.3a-signed-pointer.s

Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.td?rev=338029&r1=338028&r2=338029&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.td (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.td Thu Jul 26 07:00:50 2018
@@ -516,31 +516,34 @@ defm FCADD : SIMDThreeSameVectorComplexH
 defm FCMLA : SIMDIndexedTiedComplexHSD<1, 0, 1, complexrotateop, "fcmla",
                                        null_frag>;
 
-let Predicates = [HasV8_3a] in {
-  // v8.3a Pointer Authentication
-  let Uses = [LR], Defs = [LR] in {
-    def PACIAZ   : SystemNoOperands<0b000, "paciaz">;
-    def PACIBZ   : SystemNoOperands<0b010, "pacibz">;
-    def AUTIAZ   : SystemNoOperands<0b100, "autiaz">;
-    def AUTIBZ   : SystemNoOperands<0b110, "autibz">;
-  }
-  let Uses = [LR, SP], Defs = [LR] in {
-    def PACIASP  : SystemNoOperands<0b001, "paciasp">;
-    def PACIBSP  : SystemNoOperands<0b011, "pacibsp">;
-    def AUTIASP  : SystemNoOperands<0b101, "autiasp">;
-    def AUTIBSP  : SystemNoOperands<0b111, "autibsp">;
-  }
-  let Uses = [X16, X17], Defs = [X17], CRm = 0b0001 in {
-    def PACIA1716  : SystemNoOperands<0b000, "pacia1716">;
-    def PACIB1716  : SystemNoOperands<0b010, "pacib1716">;
-    def AUTIA1716  : SystemNoOperands<0b100, "autia1716">;
-    def AUTIB1716  : SystemNoOperands<0b110, "autib1716">;
-  }
-
-  let Uses = [LR], Defs = [LR], CRm = 0b0000 in {
-    def XPACLRI   : SystemNoOperands<0b111, "xpaclri">;
-  }
+// v8.3a Pointer Authentication
+// These instructions inhabit part of the hint space and so can be used for
+// armv8 targets
+let Uses = [LR], Defs = [LR] in {
+  def PACIAZ   : SystemNoOperands<0b000, "paciaz">;
+  def PACIBZ   : SystemNoOperands<0b010, "pacibz">;
+  def AUTIAZ   : SystemNoOperands<0b100, "autiaz">;
+  def AUTIBZ   : SystemNoOperands<0b110, "autibz">;
+}
+let Uses = [LR, SP], Defs = [LR] in {
+  def PACIASP  : SystemNoOperands<0b001, "paciasp">;
+  def PACIBSP  : SystemNoOperands<0b011, "pacibsp">;
+  def AUTIASP  : SystemNoOperands<0b101, "autiasp">;
+  def AUTIBSP  : SystemNoOperands<0b111, "autibsp">;
+}
+let Uses = [X16, X17], Defs = [X17], CRm = 0b0001 in {
+  def PACIA1716  : SystemNoOperands<0b000, "pacia1716">;
+  def PACIB1716  : SystemNoOperands<0b010, "pacib1716">;
+  def AUTIA1716  : SystemNoOperands<0b100, "autia1716">;
+  def AUTIB1716  : SystemNoOperands<0b110, "autib1716">;
+}
+
+let Uses = [LR], Defs = [LR], CRm = 0b0000 in {
+  def XPACLRI   : SystemNoOperands<0b111, "xpaclri">;
+}
 
+// These pointer authentication isntructions require armv8.3a
+let Predicates = [HasV8_3a] in {
   multiclass SignAuth<bits<3> prefix, bits<3> prefix_z, string asm> {
     def IA   : SignAuthOneData<prefix, 0b00, !strconcat(asm, "ia")>;
     def IB   : SignAuthOneData<prefix, 0b01, !strconcat(asm, "ib")>;
@@ -570,7 +573,7 @@ let Predicates = [HasV8_3a] in {
   def BLRAAZ  : AuthOneOperand<0b001, 0, "blraaz">;
   def BLRABZ  : AuthOneOperand<0b001, 1, "blrabz">;
 
-  let isReturn = 1 in {
+  let isReturn = 1, isTerminator = 1, isBarrier = 1 in {
     def RETAA   : AuthReturn<0b010, 0, "retaa">;
     def RETAB   : AuthReturn<0b010, 1, "retab">;
     def ERETAA  : AuthReturn<0b100, 0, "eretaa">;

Modified: llvm/trunk/test/MC/AArch64/armv8.3a-signed-pointer.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/armv8.3a-signed-pointer.s?rev=338029&r1=338028&r2=338029&view=diff
==============================================================================
--- llvm/trunk/test/MC/AArch64/armv8.3a-signed-pointer.s (original)
+++ llvm/trunk/test/MC/AArch64/armv8.3a-signed-pointer.s Thu Jul 26 07:00:50 2018
@@ -70,43 +70,43 @@
 
   paciasp
 // CHECK: paciasp        // encoding: [0x3f,0x23,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   autiasp
 // CHECK: autiasp        // encoding: [0xbf,0x23,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   paciaz
 // CHECK: paciaz         // encoding: [0x1f,0x23,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   autiaz
 // CHECK: autiaz         // encoding: [0x9f,0x23,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   pacia1716
 // CHECK: pacia1716      // encoding: [0x1f,0x21,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   autia1716
 // CHECK: autia1716      // encoding: [0x9f,0x21,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   pacibsp
 // CHECK: pacibsp        // encoding: [0x7f,0x23,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   autibsp
 // CHECK: autibsp        // encoding: [0xff,0x23,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   pacibz
 // CHECK: pacibz         // encoding: [0x5f,0x23,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   autibz
 // CHECK: autibz         // encoding: [0xdf,0x23,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   pacib1716
 // CHECK: pacib1716      // encoding: [0x5f,0x21,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   autib1716
 // CHECK: autib1716      // encoding: [0xdf,0x21,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
   xpaclri
 // CHECK: xpaclri           // encoding: [0xff,0x20,0x03,0xd5]
-// CHECK-REQ: error: instruction requires: armv8.3a
+// CHECK-REQ-NOT: error: instruction requires: armv8.3a
 
   pacia x0, x1
 // CHECK: pacia x0, x1     // encoding: [0x20,0x00,0xc1,0xda]




More information about the llvm-commits mailing list