llvm.org GIT mirror llvm / 4db98be
The inline asm operand modifier 'n' is suppose to be generic across architectures. It has the following description in the gnu sources: Negate the immediate constant Several Architectures such as x86 have local implementations of operand modifier 'n' which go beyond the above description slightly. This won't affect them. Affected files: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Added 'n' to the switch cases. test/CodeGen/Generic/asm-large-immediate.ll Generic compiled test (x86 for me) test/CodeGen/Mips/asm-large-immediate.ll Mips compiled version of the generic one Contributer: Jack Carter git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158939 91177308-0d34-0410-b5e6-96231b3b80d8 Jack Carter 8 years ago
3 changed file(s) with 12 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
419419 default:
420420 return true; // Unknown modifier.
421421 case 'c': // Substitute immediate value without immediate syntax
422 if ((MO.getType()) != MachineOperand::MO_Immediate)
422 if (MO.getType() != MachineOperand::MO_Immediate)
423423 return true;
424424 O << MO.getImm();
425 return false;
426 case 'n': // Negate the immediate constant.
427 if (MO.getType() != MachineOperand::MO_Immediate)
428 return true;
429 O << -MO.getImm();
425430 return false;
426431 }
427432 }
None ; RUN: llc < %s | grep 68719476738
0 ; RUN: llc < %s | FileCheck %s
11
22 define void @test() {
33 entry:
4 ; CHECK: /* result: 68719476738 */
45 tail call void asm sideeffect "/* result: ${0:c} */", "i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 )
6 ; CHECK: /* result: -68719476738 */
7 tail call void asm sideeffect "/* result: ${0:n} */", "i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 )
58 ret void
69 }
710
None ; RUNx: llc -march=mipsel < %s | grep 68719476738
1
2 ; RUN: llc -march=mipsel < %s | FileCheck %s
31 define void @test() {
42 entry:
53 ; CHECK: /* result: 68719476738 */
64 tail call void asm sideeffect "/* result: ${0:c} */", "i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 )
5 ; CHECK: /* result: -68719476738 */
6 tail call void asm sideeffect "/* result: ${0:n} */", "i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 )
77 ret void
88 }
99