diff options
author | Fangrui Song <maskray@google.com> | 2017-10-21 16:59:40 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2017-10-21 16:59:40 +0000 |
commit | c7b749bd06824ad9bfb81bc159496b5361cd1ea5 (patch) | |
tree | 7198b6eeb5997510eb78a4df0835725ee6901e8a /llvm/lib | |
parent | 2b3bc4ce2b5383d1ee5a46edcaa2f72fd4126371 (diff) | |
download | bcm5719-llvm-c7b749bd06824ad9bfb81bc159496b5361cd1ea5.tar.gz bcm5719-llvm-c7b749bd06824ad9bfb81bc159496b5361cd1ea5.zip |
[PPC CodeGen] Fix the bitreverse.i64 intrinsic.
Summary: The two 32-bit words were swapped.
Subscribers: nemanjai, kbarton
Differential Revision: https://reviews.llvm.org/D38705
llvm-svn: 316270
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrInfo.td | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td index e22c466b203..92cf29c4548 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -4668,7 +4668,7 @@ def DWLo32RotateInsertByte1 { } def ExtendLo32 { - dag To64Bit = + dag ToLo32 = (i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), DWLo32RotateInsertByte1.Left, sub_32)); } @@ -4695,15 +4695,17 @@ def DWHi32RotateInsertByte1 { (RLWIMI DWHi32RotateInsertByte3.Left, DWExtractHi32.SubReg, 8, 24, 31); } -def ExtendHi32 { - dag To64Bit = +def MoveHi32 { + dag ToLo32 = (i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), DWHi32RotateInsertByte1.Left, sub_32)); } -def DWShiftLo32 { // SLDI ExtendHi32.To64Bit, 32 - dag ToHi32 = (RLDICR ExtendHi32.To64Bit, 32, 31); +// Now byte-swap within the high word and low word both are done, next +// swap the high word and low word. +def DWShiftLo32 { // SLDI ExtendLo32.ToLo32, 32 + dag ToHi32 = (RLDICR ExtendLo32.ToLo32, 32, 31); } def : Pat<(i64 (bitreverse i64:$A)), - (OR8 DWShiftLo32.ToHi32, ExtendLo32.To64Bit)>; + (OR8 DWShiftLo32.ToHi32, MoveHi32.ToLo32)>; |