[llvm] r251489 - [PowerPC] Replace cntlz[.] with cntlzw[.]
Hal Finkel via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 27 20:26:46 PDT 2015
Author: hfinkel
Date: Tue Oct 27 22:26:45 2015
New Revision: 251489
URL: http://llvm.org/viewvc/llvm-project?rev=251489&view=rev
Log:
[PowerPC] Replace cntlz[.] with cntlzw[.]
cntlz is the old POWER mnemonic. cntlzw is the PowerPC mnemonic.
This change fixes an issue when -no-integrated-as: The opcode cntlz is
unrecognized by gas
Alias the POWER mnemonic cntlz[.] to the PowerPC mnemonic cntlzw[.]
This is done for because the POWER cntlz mnemonic has be used by LLVM for
a very long time. We need to make sure that assembly programs
that are using the cntlz[.] do not break with this change.
Change PowerPC tests to reflect the insn change from cntlz to cntlzw.
Add assembly test to verify cntlz[.] is encoded correctly.
Patch by Tom Rix!
Modified:
llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td
llvm/trunk/test/CodeGen/PowerPC/cttz.ll
llvm/trunk/test/CodeGen/PowerPC/long-compare.ll
llvm/trunk/test/CodeGen/PowerPC/seteq-0.ll
llvm/trunk/test/MC/Disassembler/PowerPC/ppc64-encoding.txt
llvm/trunk/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt
llvm/trunk/test/MC/PowerPC/ppc64-encoding.s
Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=251489&r1=251488&r2=251489&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Tue Oct 27 22:26:45 2015
@@ -3883,8 +3883,11 @@ def : InstAlias<"rotlw. $rA, $rS, $rB",
def : InstAlias<"clrlwi $rA, $rS, $n", (RLWINM gprc:$rA, gprc:$rS, 0, u5imm:$n, 31)>;
def : InstAlias<"clrlwi. $rA, $rS, $n", (RLWINMo gprc:$rA, gprc:$rS, 0, u5imm:$n, 31)>;
-def : InstAlias<"cntlz $rA, $rS", (CNTLZW gprc:$rA, gprc:$rS)>;
-def : InstAlias<"cntlz. $rA, $rS", (CNTLZWo gprc:$rA, gprc:$rS)>;
+def : InstAlias<"cntlzw $rA, $rS", (CNTLZW gprc:$rA, gprc:$rS)>;
+def : InstAlias<"cntlzw. $rA, $rS", (CNTLZWo gprc:$rA, gprc:$rS)>;
+// The POWER variant
+def : MnemonicAlias<"cntlz", "cntlzw">;
+def : MnemonicAlias<"cntlz.", "cntlzw.">;
def EXTLDI : PPCAsmPseudo<"extldi $rA, $rS, $n, $b",
(ins g8rc:$rA, g8rc:$rS, u6imm:$n, u6imm:$b)>;
Modified: llvm/trunk/test/CodeGen/PowerPC/cttz.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/cttz.ll?rev=251489&r1=251488&r2=251489&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/cttz.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/cttz.ll Tue Oct 27 22:26:45 2015
@@ -6,7 +6,7 @@ declare i32 @llvm.cttz.i32(i32, i1)
define i32 @bar(i32 %x) {
entry:
; CHECK: @bar
-; CHECK: cntlz
+; CHECK: cntlzw
%tmp.1 = call i32 @llvm.cttz.i32( i32 %x, i1 true ) ; <i32> [#uses=1]
ret i32 %tmp.1
}
Modified: llvm/trunk/test/CodeGen/PowerPC/long-compare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/long-compare.ll?rev=251489&r1=251488&r2=251489&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/long-compare.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/long-compare.ll Tue Oct 27 22:26:45 2015
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=ppc32 | grep cntlz
+; RUN: llc < %s -march=ppc32 | grep cntlzw
; RUN: llc < %s -march=ppc32 | not grep xori
; RUN: llc < %s -march=ppc32 | not grep "li "
; RUN: llc < %s -march=ppc32 | not grep "mr "
Modified: llvm/trunk/test/CodeGen/PowerPC/seteq-0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/seteq-0.ll?rev=251489&r1=251488&r2=251489&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/seteq-0.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/seteq-0.ll Tue Oct 27 22:26:45 2015
@@ -5,7 +5,7 @@ define i32 @eq0(i32 %a) {
%tmp.2 = zext i1 %tmp.1 to i32 ; <i32> [#uses=1]
ret i32 %tmp.2
-; CHECK: cntlz [[REG:r[0-9]+]], r3
+; CHECK: cntlzw [[REG:r[0-9]+]], r3
; CHECK: rlwinm r3, [[REG]], 27, 31, 31
; CHECK: blr
}
Modified: llvm/trunk/test/MC/Disassembler/PowerPC/ppc64-encoding.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/PowerPC/ppc64-encoding.txt?rev=251489&r1=251488&r2=251489&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/PowerPC/ppc64-encoding.txt (original)
+++ llvm/trunk/test/MC/Disassembler/PowerPC/ppc64-encoding.txt Tue Oct 27 22:26:45 2015
@@ -508,10 +508,10 @@
# CHECK: extsh. 2, 3
0x7c 0x62 0x07 0x35
-# CHECK: cntlz 2, 3
+# CHECK: cntlzw 2, 3
0x7c 0x62 0x00 0x34
-# CHECK: cntlz. 2, 3
+# CHECK: cntlzw. 2, 3
0x7c 0x62 0x00 0x35
# CHECK: popcntw 2, 3
Modified: llvm/trunk/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt?rev=251489&r1=251488&r2=251489&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt (original)
+++ llvm/trunk/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt Tue Oct 27 22:26:45 2015
@@ -508,10 +508,10 @@
# CHECK: extsh. 2, 3
0x35 0x07 0x62 0x7c
-# CHECK: cntlz 2, 3
+# CHECK: cntlzw 2, 3
0x34 0x00 0x62 0x7c
-# CHECK: cntlz. 2, 3
+# CHECK: cntlzw. 2, 3
0x35 0x00 0x62 0x7c
# CHECK: popcntw 2, 3
Modified: llvm/trunk/test/MC/PowerPC/ppc64-encoding.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/PowerPC/ppc64-encoding.s?rev=251489&r1=251488&r2=251489&view=diff
==============================================================================
--- llvm/trunk/test/MC/PowerPC/ppc64-encoding.s (original)
+++ llvm/trunk/test/MC/PowerPC/ppc64-encoding.s Tue Oct 27 22:26:45 2015
@@ -634,18 +634,20 @@
# CHECK-LE: extsh. 2, 3 # encoding: [0x35,0x07,0x62,0x7c]
extsh. 2, 3
-# CHECK-BE: cntlz 2, 3 # encoding: [0x7c,0x62,0x00,0x34]
-# CHECK-LE: cntlz 2, 3 # encoding: [0x34,0x00,0x62,0x7c]
+# CHECK-BE: cntlzw 2, 3 # encoding: [0x7c,0x62,0x00,0x34]
+# CHECK-LE: cntlzw 2, 3 # encoding: [0x34,0x00,0x62,0x7c]
cntlzw 2, 3
-# CHECK-BE: cntlz. 2, 3 # encoding: [0x7c,0x62,0x00,0x35]
-# CHECK-LE: cntlz. 2, 3 # encoding: [0x35,0x00,0x62,0x7c]
+# CHECK-BE: cntlzw. 2, 3 # encoding: [0x7c,0x62,0x00,0x35]
+# CHECK-LE: cntlzw. 2, 3 # encoding: [0x35,0x00,0x62,0x7c]
cntlzw. 2, 3
-# CHECK-BE: cntlz 2, 3 # encoding: [0x7c,0x62,0x00,0x34]
-# CHECK-LE: cntlz 2, 3 # encoding: [0x34,0x00,0x62,0x7c]
- cntlz 2, 3
-# CHECK-BE: cntlz. 2, 3 # encoding: [0x7c,0x62,0x00,0x35]
-# CHECK-LE: cntlz. 2, 3 # encoding: [0x35,0x00,0x62,0x7c]
- cntlz. 2, 3
+#
+# The POWER variant of cntlzw
+# CHECK-BE: cntlzw 2, 3 # encoding: [0x7c,0x62,0x00,0x34]
+# CHECK-LE: cntlzw 2, 3 # encoding: [0x34,0x00,0x62,0x7c]
+ cntlz 2, 3
+# CHECK-BE: cntlzw. 2, 3 # encoding: [0x7c,0x62,0x00,0x35]
+# CHECK-LE: cntlzw. 2, 3 # encoding: [0x35,0x00,0x62,0x7c]
+ cntlz. 2, 3
cmpb 7, 21, 4
# CHECK-BE: cmpb 7, 21, 4 # encoding: [0x7e,0xa7,0x23,0xf8]
# CHECK-LE: cmpb 7, 21, 4 # encoding: [0xf8,0x23,0xa7,0x7e]
More information about the llvm-commits
mailing list