[mips] Support 'y' operand code to print exact log2 of the operand
llvm-svn: 324477
diff --git a/llvm/test/CodeGen/Mips/inlineasm-opcode-bad-y.ll b/llvm/test/CodeGen/Mips/inlineasm-opcode-bad-y.ll
new file mode 100644
index 0000000..e94b608
--- /dev/null
+++ b/llvm/test/CodeGen/Mips/inlineasm-opcode-bad-y.ll
@@ -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
+}
diff --git a/llvm/test/CodeGen/Mips/inlineasm-operand-code.ll b/llvm/test/CodeGen/Mips/inlineasm-operand-code.ll
index 6b46884..0b8e831 100644
--- a/llvm/test/CodeGen/Mips/inlineasm-operand-code.ll
+++ b/llvm/test/CodeGen/Mips/inlineasm-operand-code.ll
@@ -63,6 +63,17 @@
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: