From: Hal Finkel Date: Tue, 10 Feb 2015 18:45:02 +0000 (+0000) Subject: [PowerPC] Support the (old) cntlz instruction alias X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=241ede07b0ceeeee9709da377d4418046e7d2b03;p=oota-llvm.git [PowerPC] Support the (old) cntlz instruction alias Some old assembly code uses the cntlz alias for cntlzw, binutils supports this, and we should too. Fixes PR22519. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228719 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/PowerPC/PPCInstrInfo.td b/lib/Target/PowerPC/PPCInstrInfo.td index 36f7f5a2462..f6cc93dcf26 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.td +++ b/lib/Target/PowerPC/PPCInstrInfo.td @@ -3566,6 +3566,9 @@ def : InstAlias<"rotlw. $rA, $rS, $rB", (RLWNMo gprc:$rA, gprc:$rS, gprc:$rB, 0, 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 EXTLDI : PPCAsmPseudo<"extldi $rA, $rS, $n, $b", (ins g8rc:$rA, g8rc:$rS, u6imm:$n, u6imm:$b)>; def EXTLDIo : PPCAsmPseudo<"extldi. $rA, $rS, $n, $b", diff --git a/test/MC/PowerPC/ppc64-encoding.s b/test/MC/PowerPC/ppc64-encoding.s index 6d09dfd8e5f..d2ac6692e71 100644 --- a/test/MC/PowerPC/ppc64-encoding.s +++ b/test/MC/PowerPC/ppc64-encoding.s @@ -612,6 +612,12 @@ # 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: 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]