[PATCH] D68356: [AArch64InstPrinter] prefer bfi to bfc for < armv8.2-a

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 13:39:07 PDT 2019


nickdesaulniers updated this revision to Diff 222902.
nickdesaulniers added a comment.

- git-clang-format HEAD~


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68356/new/

https://reviews.llvm.org/D68356

Files:
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
  llvm/test/MC/AArch64/armv8.2a-bfc.s


Index: llvm/test/MC/AArch64/armv8.2a-bfc.s
===================================================================
--- /dev/null
+++ llvm/test/MC/AArch64/armv8.2a-bfc.s
@@ -0,0 +1,11 @@
+// RUN: llvm-mc -triple aarch64-linux-gnu -o - %s | FileCheck %s --check-prefix=BFI
+// RUN: llvm-mc -triple aarch64-linux-gnu -o - %s -mattr=+v8.1a | FileCheck %s --check-prefix=BFI
+// RUN: llvm-mc -triple aarch64-linux-gnu -o - %s -mattr=-v8.2a | FileCheck %s --check-prefix=BFI
+// RUN: llvm-mc -triple aarch64-linux-gnu -o - %s -mattr=+v8.2a | FileCheck %s --check-prefix=BFC
+// RUN: llvm-mc -triple aarch64-linux-gnu -o - %s -mattr=+v8.3a | FileCheck %s --check-prefix=BFC
+// RUN: llvm-mc -triple aarch64-linux-gnu -o - %s -mattr=+v8.4a | FileCheck %s --check-prefix=BFC
+// RUN: llvm-mc -triple aarch64-linux-gnu -o - %s -mattr=+v8.5a | FileCheck %s --check-prefix=BFC
+  bfc w0, #1, #5
+
+// BFI: bfi w0, wzr, #1, #5
+// BFC: bfc w0, #1, #5
Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
===================================================================
--- llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
+++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
@@ -172,7 +172,8 @@
     int ImmS = MI->getOperand(4).getImm();
 
     if ((Op2.getReg() == AArch64::WZR || Op2.getReg() == AArch64::XZR) &&
-        (ImmR == 0 || ImmS < ImmR)) {
+        (ImmR == 0 || ImmS < ImmR) &&
+        STI.getFeatureBits()[AArch64::HasV8_2aOps]) {
       // BFC takes precedence over its entire range, sligtly differently to BFI.
       int BitWidth = Opcode == AArch64::BFMXri ? 64 : 32;
       int LSB = (BitWidth - ImmR) % BitWidth;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68356.222902.patch
Type: text/x-patch
Size: 1659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191002/ec13d5f0/attachment.bin>


More information about the llvm-commits mailing list