mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
[mips] Support 'y' operand code to print exact log2 of the operand
llvm-svn: 324477
This commit is contained in:
parent
6cf477a87b
commit
156abd7667
@ -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) {
|
||||
|
11
test/CodeGen/Mips/inlineasm-opcode-bad-y.ll
Normal file
11
test/CodeGen/Mips/inlineasm-opcode-bad-y.ll
Normal file
@ -0,0 +1,11 @@
|
||||
; Negative test for the 'm' operand code. This operand code is applicable
|
||||
; for an immediate whic is exact power of 2.
|
||||
|
||||
; RUN: not llc -march=mips < %s 2>&1 | FileCheck %s
|
||||
|
||||
define i32 @foo() nounwind {
|
||||
entry:
|
||||
; CHECK: error: invalid operand in inline asm: 'addiu $0, $1, ${2:y}'
|
||||
tail call i32 asm sideeffect "addiu $0, $1, ${2:y}", "=r,r,I"(i32 7, i32 3) ;
|
||||
ret i32 0
|
||||
}
|
@ -63,6 +63,17 @@ entry:
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
; y with 4
|
||||
define i32 @constraint_y_4() nounwind {
|
||||
entry:
|
||||
; ALL-LABEL: constraint_y_4:
|
||||
; ALL: #APP
|
||||
; ALL: addiu ${{[0-9]+}}, ${{[0-9]+}}, 2
|
||||
; ALL: #NO_APP
|
||||
tail call i32 asm sideeffect "addiu $0, $1, ${2:y}", "=r,r,I"(i32 7, i32 4) ;
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
; z with -3
|
||||
define void @constraint_z_0() nounwind {
|
||||
entry:
|
||||
|
Loading…
Reference in New Issue
Block a user