summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2018-02-07 12:36:39 +0000
committerSimon Atanasyan <simon@atanasyan.com>2018-02-07 12:36:39 +0000
commit70498f81dea7104b45269714d2238fe01263ab01 (patch)
treea6ba04235c0d130cc57952e0ceb0e7b8a3dcef7e /llvm/lib/Target/Mips
parent737bec38d0bd6ced5639169c1445791327911e01 (diff)
downloadbcm5719-llvm-70498f81dea7104b45269714d2238fe01263ab01.tar.gz
bcm5719-llvm-70498f81dea7104b45269714d2238fe01263ab01.zip
[mips] Support 'y' operand code to print exact log2 of the operand
llvm-svn: 324477
Diffstat (limited to 'llvm/lib/Target/Mips')
-rw-r--r--llvm/lib/Target/Mips/MipsAsmPrinter.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index 7953a36442d..97bb5fbdf95 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -499,6 +499,13 @@ bool MipsAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
return true;
O << MO.getImm() - 1;
return false;
+ case 'y': // exact log2
+ if ((MO.getType()) != MachineOperand::MO_Immediate)
+ return true;
+ if (!isPowerOf2_64(MO.getImm()))
+ return true;
+ O << Log2_64(MO.getImm());
+ return false;
case 'z':
// $0 if zero, regular printing otherwise
if (MO.getType() == MachineOperand::MO_Immediate && MO.getImm() == 0) {
OpenPOWER on IntegriCloud