[llvm] r208958 - ARM64: give MOV priority over shorter ORR when printing aliases.
Tim Northover
tnorthover at apple.com
Fri May 16 02:41:04 PDT 2014
Author: tnorthover
Date: Fri May 16 04:41:03 2014
New Revision: 208958
URL: http://llvm.org/viewvc/llvm-project?rev=208958&view=rev
Log:
ARM64: give MOV priority over shorter ORR when printing aliases.
MOV is almost always the right thing to print if possile. People understand it.
This will be tested when the TableGen "should I print this Alias" heuristic is
fixed (very soon).
Modified:
llvm/trunk/lib/Target/ARM64/ARM64InstrInfo.td
Modified: llvm/trunk/lib/Target/ARM64/ARM64InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM64/ARM64InstrInfo.td?rev=208958&r1=208957&r2=208958&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM64/ARM64InstrInfo.td (original)
+++ llvm/trunk/lib/Target/ARM64/ARM64InstrInfo.td Fri May 16 04:41:03 2014
@@ -708,8 +708,23 @@ defm ORN : LogicalReg<0b01, 1, "orn",
BinOpFrag<(or node:$LHS, (not node:$RHS))>>;
defm ORR : LogicalReg<0b01, 0, "orr", or>;
-def : InstAlias<"mov $dst, $src", (ORRWrs GPR32:$dst, WZR, GPR32:$src, 0)>;
-def : InstAlias<"mov $dst, $src", (ORRXrs GPR64:$dst, XZR, GPR64:$src, 0)>;
+// FIXME: these aliases are named so that they get considered by TableGen before
+// the already instantiated anonymous_ABC ones. Some kind of explicit priority
+// system would be better.
+def AA_MOVWr : InstAlias<"mov $dst, $src",
+ (ORRWrs GPR32:$dst, WZR, GPR32:$src, 0)>;
+def AA_MOVXr : InstAlias<"mov $dst, $src",
+ (ORRXrs GPR64:$dst, XZR, GPR64:$src, 0)>;
+
+def AA_MVNWr : InstAlias<"mvn $Wd, $Wm",
+ (ORNWrs GPR32:$Wd, WZR, GPR32:$Wm, 0)>;
+def AA_MVNXr : InstAlias<"mvn $Xd, $Xm",
+ (ORNXrs GPR64:$Xd, XZR, GPR64:$Xm, 0)>;
+
+def AA_MVNWrs : InstAlias<"mvn $Wd, $Wm$sh",
+ (ORNWrs GPR32:$Wd, WZR, GPR32:$Wm, logical_shift32:$sh)>;
+def AA_MVNXrs : InstAlias<"mvn $Xd, $Xm$sh",
+ (ORNXrs GPR64:$Xd, XZR, GPR64:$Xm, logical_shift64:$sh)>;
def : InstAlias<"tst $src1, $src2",
(ANDSWri WZR, GPR32:$src1, logical_imm32:$src2)>;
@@ -726,15 +741,6 @@ def : InstAlias<"tst $src1, $src2, $sh",
def : InstAlias<"tst $src1, $src2, $sh",
(ANDSXrs XZR, GPR64:$src1, GPR64:$src2, logical_shift64:$sh)>;
-def : InstAlias<"mvn $Wd, $Wm",
- (ORNWrs GPR32:$Wd, WZR, GPR32:$Wm, 0)>;
-def : InstAlias<"mvn $Xd, $Xm",
- (ORNXrs GPR64:$Xd, XZR, GPR64:$Xm, 0)>;
-
-def : InstAlias<"mvn $Wd, $Wm, $sh",
- (ORNWrs GPR32:$Wd, WZR, GPR32:$Wm, logical_shift32:$sh)>;
-def : InstAlias<"mvn $Xd, $Xm, $sh",
- (ORNXrs GPR64:$Xd, XZR, GPR64:$Xm, logical_shift64:$sh)>;
def : Pat<(not GPR32:$Wm), (ORNWrr WZR, GPR32:$Wm)>;
def : Pat<(not GPR64:$Xm), (ORNXrr XZR, GPR64:$Xm)>;
More information about the llvm-commits
mailing list